]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
desktop-file test: Expand coverage to include more corner-cases
authorSimon McVittie <smcv@collabora.com>
Thu, 18 Oct 2018 12:57:13 +0000 (13:57 +0100)
committerSimon McVittie <smcv@collabora.com>
Fri, 19 Oct 2018 11:11:55 +0000 (11:11 +0000)
Signed-off-by: Simon McVittie <smcv@collabora.com>
test/internals/desktop-file.c

index d636e7b1b9fff7a8d85b2d53ab505ce9af12bcc1..e4fef9855347741324f312d959bc6d547a52e98a 100644 (file)
@@ -86,6 +86,13 @@ static const Test valid_content[] =
   { "odd whitespace",
     "\n\n    \n[D-BUS Service]\n    \n",
     -1 },
+  /* Note that backslash is not included here. dbus-daemon currently
+   * interprets group names in the same way as string values, with
+   * backslash escapes interpreted; this does not appear to match
+   * the Desktop Entry Specification or the implementation in GKeyFile. */
+  { "Misc printable ASCII in section heading",
+    "[abcxyzABCXYZ012789`!\"$%^&*()-_=+{}:;'@#~<,>./?|]",
+    -1 },
   { "empty", "", -1 }
 };
 
@@ -97,6 +104,30 @@ static const Test invalid_content[] =
   { "newline in section heading",
     "[D-BUS Service\n]",
     -1 },
+  { "tab in section heading",
+    "[D-BUS\tService]",
+    -1 },
+  { "junk after section heading",
+    "[Foo] banana",
+    -1 },
+  { "opening square bracket in section heading",
+    "[Foo[]",
+    -1 },
+  { "closing square bracket in section heading",
+    "[Foo]]",
+    -1 },
+  { "control character in section heading",
+    "[Foo\001]",
+    -1 },
+  { "backspace in section heading",
+    "[Foo\177]",
+    -1 },
+  { "NUL in section heading",
+    "[Foo\000]",
+    -1 },
+  { "non-ASCII in section heading",
+    "[Foo\xc2\xa3]",
+    -1 },
   { "bare string not in section",
     "aaaa",
     -1 },