Просмотр исходного кода

libdpkg: add non-regression test for version number starting with non-digit

And update the non-regression test for invalid characters to put
the invalid character as the second character and not the first (which
would be caught by the more strict non-digit check).
Raphaël Hertzog лет назад: 15
Родитель
Сommit
fa98524b58
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      lib/dpkg/test/t-version.c

+ 5 - 2
lib/dpkg/test/t-version.c

@@ -141,10 +141,13 @@ test_version_parse(void)
 	test_fail(parseversion(&a, "a:0-0") == NULL);
 	test_fail(parseversion(&a, "A:0-0") == NULL);
 
+	/* Test upstream version not starting with a digit */
+	test_fail(parseversion(&a, "0:abc3-0") == NULL);
+
 	/* Test invalid characters in upstream version. */
-	verstr = m_strdup("0:0-0");
+	verstr = m_strdup("0:0a-0");
 	for (p = "!#@$%&/|\\<>()[]{};,_=*^'"; *p; p++) {
-		verstr[2] = *p;
+		verstr[3] = *p;
 		test_fail(parseversion(&a, verstr) == NULL);
 	}
 	free(verstr);