diff options
author | James Booth <boothj5@gmail.com> | 2015-02-08 21:03:26 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2015-02-08 21:03:26 +0000 |
commit | 8cec79faef1b0f49ee0d951aef5234724973a48f (patch) | |
tree | ffa34c550b1497f0a6394beaed167d22c50aa0d4 /tests | |
parent | 129af0eafd7ccf2629e60f3cfb398a0f22492b63 (diff) | |
parent | 44c5b34a710f7c90b455ec92146530f95e25ab90 (diff) | |
download | profani-tty-8cec79faef1b0f49ee0d951aef5234724973a48f.tar.gz |
Merge branch 'master' into readline
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_common.c | 44 | ||||
-rw-r--r-- | tests/test_common.h | 6 | ||||
-rw-r--r-- | tests/testsuite.c | 4 |
3 files changed, 53 insertions, 1 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); +} + diff --git a/tests/test_common.h b/tests/test_common.h index 1866e73d..b4b98e5a 100644 --- a/tests/test_common.h +++ b/tests/test_common.h @@ -51,4 +51,8 @@ void utf8_display_len_1_non_wide(void **state); void utf8_display_len_1_wide(void **state); void utf8_display_len_non_wide(void **state); void utf8_display_len_wide(void **state); -void utf8_display_len_all_wide(void **state); \ No newline at end of file +void utf8_display_len_all_wide(void **state); +void strip_quotes_does_nothing_when_no_quoted(void **state); +void strip_quotes_strips_first(void **state); +void strip_quotes_strips_last(void **state); +void strip_quotes_strips_both(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index 92abee4b..0c6a4402 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -90,6 +90,10 @@ int main(int argc, char* argv[]) { unit_test(utf8_display_len_non_wide), unit_test(utf8_display_len_wide), unit_test(utf8_display_len_all_wide), + unit_test(strip_quotes_does_nothing_when_no_quoted), + unit_test(strip_quotes_strips_first), + unit_test(strip_quotes_strips_last), + unit_test(strip_quotes_strips_both), unit_test(clear_empty), unit_test(reset_after_create), |