shithub: scc

Download patch

ref: f764b7c8342bd000d43eea624bc6265b8f3a8a7f
parent: 2fc84f35db1880e0557e1e5f1f008370ee7ee545
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Oct 3 06:14:46 EDT 2021

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.

--- a/tests/libc/execute/0026-strstr.c
+++ b/tests/libc/execute/0026-strstr.c
@@ -22,8 +22,9 @@
 	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;