summaryrefslogtreecommitdiff
path: root/libc/test/src/string/strtok_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libc/test/src/string/strtok_test.cpp')
-rw-r--r--libc/test/src/string/strtok_test.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/test/src/string/strtok_test.cpp b/libc/test/src/string/strtok_test.cpp
index 76efeddda6f4..3c097fdee071 100644
--- a/libc/test/src/string/strtok_test.cpp
+++ b/libc/test/src/string/strtok_test.cpp
@@ -83,3 +83,10 @@ TEST(LlvmLibcStrTokTest, SubsequentSearchesReturnNull) {
ASSERT_EQ(LIBC_NAMESPACE::strtok(nullptr, ":"), nullptr);
ASSERT_EQ(LIBC_NAMESPACE::strtok(nullptr, ":"), nullptr);
}
+
+TEST(LlvmLibcStrTokTest, TopBitSet) {
+ char top_bit_set_str[] = "hello\x80world";
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(top_bit_set_str, "\x80"), "hello");
+ ASSERT_STREQ(LIBC_NAMESPACE::strtok(nullptr, "\x80"), "world");
+ ASSERT_EQ(LIBC_NAMESPACE::strtok(nullptr, "\x80"), nullptr);
+}