summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-08-27 14:48:32 -0700
committerMichael Bestas <mikeioannina@gmail.com>2015-11-07 16:46:15 +0200
commit5ffc0c975693345ce0eb829b9faa3c50173730ed (patch)
tree1ea5746acd19a07b65c7d418c448dd9fe8889b09 /tests
parent607f747e59a3dea20ed324419f8afc611fd66ee1 (diff)
downloadbionic-5ffc0c975693345ce0eb829b9faa3c50173730ed.zip
bionic-5ffc0c975693345ce0eb829b9faa3c50173730ed.tar.gz
bionic-5ffc0c975693345ce0eb829b9faa3c50173730ed.tar.bz2
Fix regoff_t for LP32 and _FILE_OFFSET_BITS=64.
bionic is built without _FILE_OFFSET_BITS=64, so internally regoff_t was 32-bit on LP32, but code compiled with _FILE_OFFSET_BITS would expect rm_so and rm_eo in struct regmatch_t to be 64-bit, leading to confusion. Bug: http://b/23566443 Change-Id: Iae92fa545104068e4f64ce1977f5ec616859638c
Diffstat (limited to 'tests')
-rw-r--r--tests/regex_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regex_test.cpp b/tests/regex_test.cpp
index d026221..4a4409e 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);
+}