瀏覽代碼

libdpkg: Add more test cases for version parsing failures

Guillem Jover 15 年之前
父節點
當前提交
07a8f6d882
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      lib/dpkg/test/t-version.c

+ 9 - 0
lib/dpkg/test/t-version.c

@@ -137,6 +137,15 @@ test_version_parse(void)
 	test_pass(parseversion(&a, "0:0-azAZ09.+~") == NULL);
 	test_pass(versioncompare(&a, &b) == 0);
 
+	/* Test empty version. */
+	test_fail(parseversion(&a, "") == NULL);
+
+	/* Test empty upstream version after epoch. */
+	test_fail(parseversion(&a, "0:") == NULL);
+
+	/* Test version with embedded spaces. */
+	test_fail(parseversion(&a, "0:0 0-1") == NULL);
+
 	/* Test invalid characters in epoch. */
 	test_fail(parseversion(&a, "a:0-0") == NULL);
 	test_fail(parseversion(&a, "A:0-0") == NULL);