scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit f764b7c8342bd000d43eea624bc6265b8f3a8a7f
parent 2fc84f35db1880e0557e1e5f1f008370ee7ee545
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:
Mtests/libc/execute/0026-strstr.c | 5+++--
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;