about summary refs log tree commit diff stats
path: root/tests/test_parser.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-07-20 20:53:43 +0100
committerJames Booth <boothj5@gmail.com>2013-07-20 20:53:43 +0100
commit8137efbfa3a99b3e1b2f8aeeab90fe44220abc33 (patch)
treee9e628ba974e1e689b56dded6f84c4fbef4c9f86 /tests/test_parser.c
parentdd2e3a0bdf958a84f063a62b2fbf6ff7c04c0b8d (diff)
downloadprofani-tty-8137efbfa3a99b3e1b2f8aeeab90fe44220abc33.tar.gz
Added test for quoted freetext in parser
Diffstat (limited to 'tests/test_parser.c')
-rw-r--r--tests/test_parser.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_parser.c b/tests/test_parser.c
index e442baee..6df5eb1d 100644
--- a/tests/test_parser.c
+++ b/tests/test_parser.c
@@ -281,6 +281,18 @@ parse_cmd_freetext_with_many_quoted_and_many_spaces(void)
 }
 
 void
+parse_cmd_with_quoted_freetext(void)
+{
+    char *inp = "/cmd arg1 here is \"some\" quoted freetext";
+    gchar **result = parse_args_with_freetext(inp, 1, 2);
+
+    assert_int_equals(2, g_strv_length(result));
+    assert_string_equals("arg1", result[0]);
+    assert_string_equals("here is \"some\" quoted freetext", result[1]);
+    g_strfreev(result);
+}
+
+void
 count_one_token(void)
 {
     char *inp = "one";
@@ -425,6 +437,7 @@ register_parser_tests(void)
     TEST(parse_cmd_freetext_with_quoted_and_space);
     TEST(parse_cmd_freetext_with_quoted_and_many_spaces);
     TEST(parse_cmd_freetext_with_many_quoted_and_many_spaces);
+    TEST(parse_cmd_with_quoted_freetext);
     TEST(count_one_token);
     TEST(count_one_token_quoted_no_whitespace);
     TEST(count_one_token_quoted_with_whitespace);