about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-11-18 00:38:37 +0000
committerJames Booth <boothj5@gmail.com>2012-11-18 00:38:37 +0000
commit312d362eaac54926a57fb48e3d80b314f7b32ad8 (patch)
tree3a820f43a8d1774c6d276a3743175f13d3875ff3 /tests
parent191ab83c9b888ebd5f60afc256833c8062629e05 (diff)
downloadprofani-tty-312d362eaac54926a57fb48e3d80b314f7b32ad8.tar.gz
Handle commands with min 0 args
Diffstat (limited to 'tests')
-rw-r--r--tests/test_parser.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_parser.c b/tests/test_parser.c
index a3e31ed6..9a692edc 100644
--- a/tests/test_parser.c
+++ b/tests/test_parser.c
@@ -173,6 +173,30 @@ parse_cmd_two_args_with_freetext(void)
 }
 
 void
+parse_cmd_min_zero(void)
+{
+    char *inp = "/cmd";
+    int num = 0;
+    gchar **result = parse_args(inp, 0, 2, &num);
+
+    assert_int_equals(0, num);
+    assert_is_null(result[0]);
+    g_strfreev(result);
+}
+
+void
+parse_cmd_min_zero_with_freetext(void)
+{
+    char *inp = "/cmd";
+    int num = 0;
+    gchar **result = parse_args_with_freetext(inp, 0, 2, &num);
+
+    assert_int_equals(0, num);
+    assert_is_null(result[0]);
+    g_strfreev(result);
+}
+
+void
 register_parser_tests(void)
 {
     TEST_MODULE("parser tests");
@@ -190,4 +214,6 @@ register_parser_tests(void)
     TEST(parse_cmd_two_args_with_freetext);
     TEST(parse_cmd_with_too_few_returns_null);
     TEST(parse_cmd_with_too_many_returns_null);
+    TEST(parse_cmd_min_zero);
+    TEST(parse_cmd_min_zero_with_freetext);
 }