mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 10:07:41 +08:00
Add tests for regex_match ambiguity (aka LWG2273). NFC. Reviewed as https://reviews.llvm.org/D63051
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@365080 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1367,6 +1367,30 @@ int main(int, char**)
|
||||
assert(m.position(0) == 0);
|
||||
assert(m.str(0) == s);
|
||||
}
|
||||
{ // LWG 2273
|
||||
std::regex re("Foo|FooBar");
|
||||
std::cmatch m;
|
||||
{
|
||||
assert(std::regex_match("FooBar", m, re));
|
||||
assert(m.size() == 1);
|
||||
assert(m[0] == "FooBar");
|
||||
}
|
||||
{
|
||||
assert(std::regex_match("Foo", m, re));
|
||||
assert(m.size() == 1);
|
||||
assert(m[0] == "Foo");
|
||||
}
|
||||
{
|
||||
assert(!std::regex_match("FooBarBaz", m, re));
|
||||
assert(m.size() == 0);
|
||||
assert(m.empty());
|
||||
}
|
||||
{
|
||||
assert(!std::regex_match("FooBa", m, re));
|
||||
assert(m.size() == 0);
|
||||
assert(m.empty());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user