[libcxx-commits] [PATCH] D63051: Test regex match ambiguity (2273)
Zoe Carver via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 8 14:18:56 PDT 2019
zoecarver created this revision.
zoecarver added reviewers: mclow.lists, EricWF, ldionne.
Herald added subscribers: libcxx-commits, dexonsmith.
This patch resolves issue 2273 <https://cplusplus.github.io/LWG/issue2273>. This patch only adds tests. NFC.
Repository:
rCXX libc++
https://reviews.llvm.org/D63051
Files:
test/std/re/re.alg/re.alg.match/basic.pass.cpp
test/std/re/re.alg/re.alg.search/basic.pass.cpp
www/cxx1z_status.html
Index: www/cxx1z_status.html
===================================================================
--- www/cxx1z_status.html
+++ www/cxx1z_status.html
@@ -257,7 +257,7 @@
<tr><td><a href="https://wg21.link/LWG2244">2244</a></td><td>Issue on <tt>basic_istream::seekg</tt></td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2250">2250</a></td><td>Follow-up On Library Issue 2207</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2259">2259</a></td><td>Issues in 17.6.5.5 rules for member functions</td><td>Kona</td><td>Complete</td></tr>
- <tr><td><a href="https://wg21.link/LWG2273">2273</a></td><td><tt>regex_match</tt> ambiguity</td><td>Kona</td><td></td></tr>
+ <tr><td><a href="https://wg21.link/LWG2273">2273</a></td><td><tt>regex_match</tt> ambiguity</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2336">2336</a></td><td><tt>is_trivially_constructible/is_trivially_assignable</tt> traits are always false</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2353">2353</a></td><td><tt>std::next</tt> is over-constrained</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2367">2367</a></td><td><tt>pair</tt> and <tt>tuple</tt> are not correctly implemented for <tt>is_constructible</tt> with no args</td><td>Kona</td><td>Complete</td></tr>
Index: test/std/re/re.alg/re.alg.search/basic.pass.cpp
===================================================================
--- test/std/re/re.alg/re.alg.search/basic.pass.cpp
+++ test/std/re/re.alg/re.alg.search/basic.pass.cpp
@@ -1547,6 +1547,30 @@
assert(m.position(0) == 0);
assert(m.str(0) == s);
}
+ { // LWG 2273
+ std::regex re("Foo|FooBar");
+ std::cmatch m;
+ {
+ assert(std::regex_search("FooBar", m, re));
+ assert(m.size() == 1);
+ assert(m[0] == "Foo");
+ }
+ {
+ assert(std::regex_search("Foo", m, re));
+ assert(m.size() == 1);
+ assert(m[0] == "Foo");
+ }
+ {
+ assert(std::regex_search("FooBarBaz", m, re));
+ assert(m.size() == 1);
+ assert(m[0] == "Foo");
+ }
+ {
+ assert(std::regex_search("FooBa", m, re));
+ assert(m.size() == 1);
+ assert(m[0] == "Foo");
+ }
+ }
return 0;
}
Index: test/std/re/re.alg/re.alg.match/basic.pass.cpp
===================================================================
--- test/std/re/re.alg/re.alg.match/basic.pass.cpp
+++ test/std/re/re.alg/re.alg.match/basic.pass.cpp
@@ -1367,6 +1367,30 @@
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63051.203709.patch
Type: text/x-patch
Size: 3453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190608/9cfc914d/attachment-0001.bin>
More information about the libcxx-commits
mailing list