summaryrefslogtreecommitdiff
path: root/tests/regex_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regex_test.cpp')
-rw-r--r--tests/regex_test.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/regex_test.cpp b/tests/regex_test.cpp
index 4a4409ef3..0e7f8dd7f 100644
--- a/tests/regex_test.cpp
+++ b/tests/regex_test.cpp
@@ -46,3 +46,14 @@ TEST(regex, match_offsets) {
ASSERT_EQ(2, matches[0].rm_eo);
regfree(&re);
}
+
+TEST(regex, regerror_NULL_0) {
+ regex_t re;
+ int error = regcomp(&re, "*", REG_EXTENDED);
+ ASSERT_NE(0, error);
+
+ // Passing a null pointer and a size of 0 is a legitimate way to ask
+ // how large a buffer we would need for the error message.
+ int error_length = regerror(error, &re, nullptr, 0);
+ ASSERT_GT(error_length, 0);
+}