summaryrefslogtreecommitdiff
path: root/eel
diff options
context:
space:
mode:
authorErnestas Kulik <ernestask@gnome.org>2018-03-21 10:04:39 +0200
committerErnestas Kulik <ernestask@gnome.org>2018-03-21 10:05:45 +0200
commit3e3bd830b5ea14fc4bbfe3933d67d79fd906f190 (patch)
tree44d76ec8d6e77fb5b7eb339641385387a663a18c /eel
parenta01652064ad0b823c14d9f9cde057ae7ea909826 (diff)
downloadnautilus-3e3bd830b5ea14fc4bbfe3933d67d79fd906f190.tar.gz
eel: string: fix middle truncation test cases
f42979f0b073d96a9157c05c0bff963820a630b4 changed the ellipsis to a unicode one, which is one character in length, in turn changing the expected output. For cases where the truncation length is zero, the expected output is changed to NULL, as 536505728e3963cfc6d2fa93ca2b188bfb5a144b added an assertion.
Diffstat (limited to 'eel')
-rw-r--r--eel/eel-string.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/eel/eel-string.c b/eel/eel-string.c
index d7e31988e..1fa480c24 100644
--- a/eel/eel-string.c
+++ b/eel/eel-string.c
@@ -479,39 +479,39 @@ eel_self_check_string (void)
EEL_CHECK_STRING_RESULT (eel_str_capitalize ("foo"), "Foo");
EEL_CHECK_STRING_RESULT (eel_str_capitalize ("Foo"), "Foo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 0), "foo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 0), NULL);
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 1), "foo");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 3), "foo");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 4), "foo");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 5), "foo");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 6), "foo");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("foo", 7), "foo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 0), "a_much_longer_foo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 0), NULL);
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 1), "a_much_longer_foo");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 2), "a_much_longer_foo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 3), "a_much_longer_foo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 4), "a_much_longer_foo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 5), "a…o");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 6), "a…oo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 7), "a_…oo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 8), "a_…foo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 9), "a_m…foo");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 8), "so…ven");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 8), "so…odd");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 9), "som…ven");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 9), "som…odd");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 10), "som…even");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 10), "som…_odd");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 11), "some…even");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 11), "some…_odd");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 12), "some…_even");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 12), "some…g_odd");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 13), "somet…_even");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 3), "a…o");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 4), "a…oo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 5), "a_…oo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 6), "a_…foo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 7), "a_m…foo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 8), "a_m…_foo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("a_much_longer_foo", 9), "a_mu…_foo");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 8), "som…even");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 8), "som…_odd");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 9), "some…even");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 9), "some…_odd");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 10), "some…_even");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 10), "some…g_odd");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 11), "somet…_even");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 11), "somet…g_odd");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 12), "somet…g_even");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 12), "somet…ng_odd");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 13), "someth…g_even");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 13), "something_odd");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_even", 14), "something_even");
EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("something_odd", 13), "something_odd");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("ääääääääää", 5), "ä…ä");
- EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("あぃいぅうぇえぉ", 7), "あぃ…えぉ");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("ääääääääää", 5), "ää…ää");
+ EEL_CHECK_STRING_RESULT (eel_str_middle_truncate ("あぃいぅうぇえぉ", 7), "あぃい…ぇえぉ");
EEL_CHECK_STRING_RESULT (eel_str_strip_substring_and_after (NULL, "bar"), NULL);
EEL_CHECK_STRING_RESULT (eel_str_strip_substring_and_after ("", "bar"), "");