commit cae1735f86d590f9d71b407e895d81e60fb2bba1
parent b643a0e6a56ac5af4e3f69106181ef0421f256ec
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 3 Oct 2021 10:14:46 +0200
tests/libc: Fix 0026-strstr test
When the substring is an empty string strstr() must return
a pointer to the beginning of the string, and there were
several checks that were assuming a different behaviour.
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/libc/execute/0026-strstr.c b/tests/libc/execute/0026-strstr.c
@@ -22,8 +22,9 @@ main()
strcpy(buf, "ababc");
assert(strstr(buf, "abc") == buf+2);
assert(strstr("", "abc") == NULL);
- assert(strstr("abc", "") == NULL);
- assert(strstr("", "") == NULL);
+ assert(strstr(buf, "") == buf);
+ buf[0] = '\0';
+ assert(strstr(buf, "") == buf);
puts("done");
return 0;