Skip to content

Commit c05de05

Browse files
committed
add tests for nullptr
1 parent 9f68eea commit c05de05

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

libc/test/src/time/localtime_r_test.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ TEST(LlvmLibcLocaltimeR, ValidUnixTimestamp0) {
3434
ASSERT_EQ(0, result->tm_isdst);
3535
}
3636

37+
TEST(LlvmLibcLocaltime, NullPtr) {
38+
EXPECT_DEATH([] {
39+
LIBC_NAMESPACE::localtime_r(nullptr, nullptr);
40+
}, 4);
41+
}
42+
3743
// TODO(zimirza): These tests does not expect the correct output of localtime as
3844
// per specification. This is due to timezone functions removed from
3945
// https://github.com/llvm/llvm-project/pull/110363.

libc/test/src/time/localtime_test.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ TEST(LlvmLibcLocaltime, ValidUnixTimestamp0) {
2424
ASSERT_EQ(0, result->tm_isdst);
2525
}
2626

27+
TEST(LlvmLibcLocaltime, NullPtr) {
28+
EXPECT_DEATH([] {
29+
LIBC_NAMESPACE::localtime(nullptr);
30+
}, 4);
31+
}
32+
2733
// TODO(zimirza): These tests does not expect the correct output of localtime as
2834
// per specification. This is due to timezone functions removed from
2935
// https://github.com/llvm/llvm-project/pull/110363.

0 commit comments

Comments
 (0)