about summary refs log tree commit diff stats
path: root/tests/test_common.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-02-08 20:59:51 +0000
committerJames Booth <boothj5@gmail.com>2015-02-08 20:59:51 +0000
commit44c5b34a710f7c90b455ec92146530f95e25ab90 (patch)
tree4c739d224d6d67fec00c578707a062a77bf4fd19 /tests/test_common.c
parent236e508cd88f0f22688d8d9b5d5d52d8870b04ec (diff)
downloadprofani-tty-44c5b34a710f7c90b455ec92146530f95e25ab90.tar.gz
Moved quote stripper to common, added tests
Diffstat (limited to 'tests/test_common.c')
-rw-r--r--tests/test_common.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_common.c b/tests/test_common.c
index 0c4530a0..980f2198 100644
--- a/tests/test_common.c
+++ b/tests/test_common.c
@@ -587,3 +587,47 @@ void utf8_display_len_all_wide(void **state)
     assert_int_equal(8, result);
 }
 
+void strip_quotes_does_nothing_when_no_quoted(void **state)
+{
+    char *input = "/cmd test string";
+
+    char *result = strip_arg_quotes(input);
+
+    assert_string_equal("/cmd test string", result);
+
+    free(result);
+}
+
+void strip_quotes_strips_first(void **state)
+{
+    char *input = "/cmd \"test string";
+
+    char *result = strip_arg_quotes(input);
+
+    assert_string_equal("/cmd test string", result);
+    
+    free(result);
+}
+
+void strip_quotes_strips_last(void **state)
+{
+    char *input = "/cmd test string\"";
+
+    char *result = strip_arg_quotes(input);
+
+    assert_string_equal("/cmd test string", result);
+
+    free(result);
+}
+
+void strip_quotes_strips_both(void **state)
+{
+    char *input = "/cmd \"test string\"";
+
+    char *result = strip_arg_quotes(input);
+
+    assert_string_equal("/cmd test string", result);
+
+    free(result);
+}
+