|
|
@@ -47,6 +47,7 @@ test_str_match_end(void)
|
|
|
test_pass(str_match_end("foo bar quux", "quux"));
|
|
|
test_pass(str_match_end("foo bar quux", "bar quux"));
|
|
|
test_pass(str_match_end("foo bar quux", "foo bar quux"));
|
|
|
+ test_fail(str_match_end("foo bar quux", "foo bar quux zorg"));
|
|
|
test_fail(str_match_end("foo bar quux", "foo bar"));
|
|
|
test_fail(str_match_end("foo bar quux", "foo"));
|
|
|
}
|
|
|
@@ -77,6 +78,14 @@ test_str_escape_fmt(void)
|
|
|
test_str(buf, ==, "%%b%%b%%c%%c%%%% end");
|
|
|
|
|
|
/* Test delimited buffer. */
|
|
|
+ memset(buf, 'a', sizeof(buf));
|
|
|
+ q = str_escape_fmt(buf, NULL, 0);
|
|
|
+ test_mem(buf, ==, "aaaa", 4);
|
|
|
+
|
|
|
+ memset(buf, 'a', sizeof(buf));
|
|
|
+ q = str_escape_fmt(buf, "b", 1);
|
|
|
+ test_str(q, ==, "");
|
|
|
+
|
|
|
memset(buf, 'a', sizeof(buf));
|
|
|
q = str_escape_fmt(buf, "%%%", 5);
|
|
|
strcpy(q, " end");
|
|
|
@@ -93,16 +102,16 @@ test_str_quote_meta(void)
|
|
|
{
|
|
|
char *str;
|
|
|
|
|
|
- str = str_quote_meta("foo bar");
|
|
|
- test_str(str, ==, "foo\\ bar");
|
|
|
+ str = str_quote_meta("foo1 2bar");
|
|
|
+ test_str(str, ==, "foo1\\ 2bar");
|
|
|
free(str);
|
|
|
|
|
|
- str = str_quote_meta("foo?bar");
|
|
|
- test_str(str, ==, "foo\\?bar");
|
|
|
+ str = str_quote_meta("foo1?2bar");
|
|
|
+ test_str(str, ==, "foo1\\?2bar");
|
|
|
free(str);
|
|
|
|
|
|
- str = str_quote_meta("foo*bar");
|
|
|
- test_str(str, ==, "foo\\*bar");
|
|
|
+ str = str_quote_meta("foo1*2bar");
|
|
|
+ test_str(str, ==, "foo1\\*2bar");
|
|
|
free(str);
|
|
|
}
|
|
|
|
|
|
@@ -151,7 +160,7 @@ test_str_strip_quotes(void)
|
|
|
static void
|
|
|
test(void)
|
|
|
{
|
|
|
- test_plan(29);
|
|
|
+ test_plan(32);
|
|
|
|
|
|
test_str_is_set();
|
|
|
test_str_match_end();
|