summaryrefslogtreecommitdiff
path: root/tests/stdlib_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-03-08 14:07:01 -0800
committerElliott Hughes <enh@google.com>2021-03-08 14:07:01 -0800
commitbbbe27ff6e0ca301fb50012705eee8c8e380f929 (patch)
treec618596436dfc4510efd919d5c5263c9d2cb9c4e /tests/stdlib_test.cpp
parent1ef8d418be8e4630125c599b0af5c1ec96a512d3 (diff)
Improve system() coverage.
There's a weird POSIX special case that we implement but don't test. Found from looking through the coverage data. Test: treehugger Change-Id: I74f5f57c4d8062034a3f6e986f9e57091bfc7f7c
Diffstat (limited to 'tests/stdlib_test.cpp')
-rw-r--r--tests/stdlib_test.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp
index bb1fd7ce5..90ef8619f 100644
--- a/tests/stdlib_test.cpp
+++ b/tests/stdlib_test.cpp
@@ -489,6 +489,12 @@ TEST(stdlib, system) {
ASSERT_EQ(1, WEXITSTATUS(status));
}
+TEST(stdlib, system_NULL) {
+ // "The system() function shall always return non-zero when command is NULL."
+ // http://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
+ ASSERT_NE(0, system(nullptr));
+}
+
TEST(stdlib, atof) {
ASSERT_DOUBLE_EQ(1.23, atof("1.23"));
}