diff --git a/CHANGES b/CHANGES
index 9dac291657bd93fc2148a5bee819f261e81df1dc..aff59dfef9ac330b650149c8948fb7e08f23906d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Daniel Fandrich (7 Feb 2007)
+- Added tests 1022 and 1023 to validate output of curl-config --version and
+  --vernum
+
 Daniel S (7 Feb 2008)
 - Refactored a lot of timeout code into a few functions in an attempt to make
   them all use the same (hopefully correct) logic to make it less error-prone
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 7a976f9d3b608ec38e62a24cd8efc38fae531395..826b557a62d53d2bb0af37ce9a341d45a25f27cb 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -48,7 +48,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46	   \
  test2000 test2001 test2002 test2003 test35 test544 test545 test2004	   \
  test546 test1013 test1014 test1015 test547 test548 test549 test550	   \
  test551 test552 test1016 test1017 test1018 test1019 test1020 test553      \
- test1021
+ test1021 test1022 test1023
 
 filecheck:
 	@mkdir test-place; \
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am
index a808a673f43aeff7a4795bfc57e932e962ae8f1f..65c987d1ef40ca9bada02319c9bb8bf6cc76b21b 100644
--- a/tests/libtest/Makefile.am
+++ b/tests/libtest/Makefile.am
@@ -35,7 +35,7 @@ INCLUDES = -I$(top_srcdir)/include/curl \
 
 LIBDIR = $(top_builddir)/lib
 
-EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl
+EXTRA_DIST = test75.pl test307.pl test610.pl test613.pl test1013.pl test1022.pl
 
 # files used only in some libcurl test programs
 TESTUTIL = testutil.c testutil.h
diff --git a/tests/libtest/test1013.pl b/tests/libtest/test1013.pl
index b46e5ae3a1794dce67807d8b534944d94f808a48..6127df82ae6529782e08addbc6586149a1ce106f 100755
--- a/tests/libtest/test1013.pl
+++ b/tests/libtest/test1013.pl
@@ -1,8 +1,9 @@
 #!/usr/bin/env perl
-# Determine if curl-config --protocols matches the curl --version protocols
+# Determine if curl-config --protocols/--features matches the
+# curl --version protocols/features
 if ( $#ARGV != 2 ) 
 {
-	print "Usage: $0 curl-config-script curl-features-file features|protocols\n";
+	print "Usage: $0 curl-config-script curl-version-output-file features|protocols\n";
 	exit 3;
 }
 
diff --git a/tests/libtest/test1022.pl b/tests/libtest/test1022.pl
new file mode 100755
index 0000000000000000000000000000000000000000..73bfc5fc394195a0e78a49f67ba635722d53a884
--- /dev/null
+++ b/tests/libtest/test1022.pl
@@ -0,0 +1,45 @@
+#!/usr/bin/env perl
+# Determine if curl-config --version matches the curl --version
+if ( $#ARGV != 2 ) 
+{
+	print "Usage: $0 curl-config-script curl-version-output-file version|vernum\n";
+	exit 3;
+}
+
+my $what=$ARGV[2];
+
+# Read the output of curl --version
+open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n";
+$_ = <CURL>;
+chomp;
+/libcurl\/([\.\d]+(-CVS)?)/;
+my $version = $1;
+close CURL;
+
+my $curlconfigversion;
+
+# Read the output of curl-config --version/--vernum
+open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n";
+$_ = <CURLCONFIG>;
+chomp;
+if ( $what eq "version" ) {
+	/^libcurl ([\.\d]+(-CVS)?)$/ ;
+	$curlconfigversion = $1;
+}
+else {
+	# Convert hex version to decimal for comparison's sake
+	/^([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})$/ ;
+	$curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3);
+
+	# Strip off the -CVS from the curl version if it's there
+	$version =~ s/-CVS$//;
+}
+close CURLCONFIG;
+
+my $different = $version ne $curlconfigversion;
+if ($different || !$version) {
+	print "Mismatch in --version:\n";
+	print "curl:        $version\n";
+	print "curl-config: $curlconfigversion\n";
+	exit 1;
+}