diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2013-09-29 02:48:35 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2013-09-29 02:48:35 -0700 |
commit | 991c900fc6d55de3c11f23d06b5c06393abb1b2d (patch) | |
tree | 0ad376e80c6d65a4b1c1d5fa85596d4c2aec1c4d /fish_tests.cpp | |
parent | 0d2af9e7422230b633fe228d3b40c6edd229a373 (diff) |
Set of changes to improve detection of escape sequences for prompt width
computation. Addresses #767
Diffstat (limited to 'fish_tests.cpp')
-rw-r--r-- | fish_tests.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fish_tests.cpp b/fish_tests.cpp index b47ce3a3..8b79ef3a 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -550,6 +550,16 @@ static void test_utils() if (begin != a + wcslen(L"echo (echo (")) err(L"parse_util_cmdsubst_extent failed on line %ld", (long)__LINE__); } +static void test_escape_sequences(void) +{ + say(L"Testing escape codes"); + if (escape_code_length(L"") != 0) err(L"test_escape_sequences failed on line %d\n", __LINE__); + if (escape_code_length(L"abcd") != 0) err(L"test_escape_sequences failed on line %d\n", __LINE__); + if (escape_code_length(L"\x1b[2J") != 4) err(L"test_escape_sequences failed on line %d\n", __LINE__); + if (escape_code_length(L"\x1b[38;5;123mABC") != strlen("\x1b[38;5;123m")) err(L"test_escape_sequences failed on line %d\n", __LINE__); + if (escape_code_length(L"\x1b@") != 2) err(L"test_escape_sequences failed on line %d\n", __LINE__); +} + class lru_node_test_t : public lru_node_t { public: @@ -1834,6 +1844,7 @@ int main(int argc, char **argv) test_fork(); test_parser(); test_utils(); + test_escape_sequences(); test_lru(); test_expand(); test_fuzzy_match(); |