From 31ca762c6260b80bb8f8a597c4336cb173439b92 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 17 Feb 2019 09:49:49 +0100 Subject: [PATCH] Add a new test case for empty string. --- tests/test-mstring.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test-mstring.c b/tests/test-mstring.c index 58522ba7..a503fc89 100644 --- a/tests/test-mstring.c +++ b/tests/test-mstring.c @@ -91,12 +91,17 @@ static void test_utf8_basic(void) static void test_utf8_it(void) { string_t s; + string_it_t it; string_init(s); + + for(string_it(it, s) ; !string_end_p(it); string_next(it)) { + assert(0); // Shall not be called + } + const unsigned int tab[] = { 45, 1458, 25623, 129, 24 }; for(int i = 0; i < 5; i++) string_push_u (s, tab[i]); assert (string_length_u(s) == 5); - string_it_t it; int i = 0; for(string_it(it, s) ; !string_end_p(it); string_next(it), i++) { assert (i < 5);