summaryrefslogtreecommitdiff
path: root/test/internals/desktop-file.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-10-18 13:57:13 +0100
committerSimon McVittie <smcv@collabora.com>2018-10-19 11:11:55 +0000
commit9ae72325731c701fe1a4a1e9ba9815229c49069a (patch)
tree75c17024f1ff2d44bf2446e980af89fd38b97921 /test/internals/desktop-file.c
parent3ef9e789c1b99f420078f4debabd4f5c4fa0a748 (diff)
downloaddbus-9ae72325731c701fe1a4a1e9ba9815229c49069a.tar.gz
desktop-file test: Expand coverage to include more corner-cases
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'test/internals/desktop-file.c')
-rw-r--r--test/internals/desktop-file.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/internals/desktop-file.c b/test/internals/desktop-file.c
index d636e7b1..e4fef985 100644
--- a/test/internals/desktop-file.c
+++ b/test/internals/desktop-file.c
@@ -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 },