diff options
Diffstat (limited to 'tests/regex_test.cpp')
-rw-r--r-- | tests/regex_test.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regex_test.cpp b/tests/regex_test.cpp index d02622190..4a4409ef3 100644 --- a/tests/regex_test.cpp +++ b/tests/regex_test.cpp @@ -36,3 +36,13 @@ TEST(regex, smoke) { regfree(&re); } + +TEST(regex, match_offsets) { + regex_t re; + regmatch_t matches[1]; + ASSERT_EQ(0, regcomp(&re, "b", 0)); + ASSERT_EQ(0, regexec(&re, "abc", 1, matches, 0)); + ASSERT_EQ(1, matches[0].rm_so); + ASSERT_EQ(2, matches[0].rm_eo); + regfree(&re); +} |