diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2013-06-28 20:31:05 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2013-06-28 20:31:05 +0000 |
| commit | 3f75953d82307f0406d7be3e78e6ebc1f1273995 (patch) | |
| tree | 10560c12c0bdb348880c91918ac83d119ef275b3 /libcxx/test | |
| parent | c7c8dd2090e5f0a0f846c47d9ed61c07f55d3e53 (diff) | |
| download | bcm5719-llvm-3f75953d82307f0406d7be3e78e6ebc1f1273995.tar.gz bcm5719-llvm-3f75953d82307f0406d7be3e78e6ebc1f1273995.zip | |
Provide missing '{' in parsing extended quoted characters. This fixes http://llvm.org/bugs/show_bug.cgi?id=16135
llvm-svn: 185211
Diffstat (limited to 'libcxx/test')
| -rw-r--r-- | libcxx/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/libcxx/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp b/libcxx/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp new file mode 100644 index 00000000000..6a454189652 --- /dev/null +++ b/libcxx/test/re/re.alg/re.alg.match/parse_curly_brackets.pass.cpp @@ -0,0 +1,72 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <regex> + +// template <class BidirectionalIterator, class Allocator, class charT, class traits> +// bool +// regex_match(BidirectionalIterator first, BidirectionalIterator last, +// match_results<BidirectionalIterator, Allocator>& m, +// const basic_regex<charT, traits>& e, +// regex_constants::match_flag_type flags = regex_constants::match_default); + +// http://llvm.org/bugs/show_bug.cgi?id=16135 + +#include <string> +#include <regex> +#include <cassert> + +void +test1() +{ + std::string re{"\\{a\\}"}; + std::string target{"{a}"}; + std::regex regex{re}; + std::smatch smatch; + assert((std::regex_match(target, smatch, regex))); +} + +void +test2() +{ + std::string re{"\\{a\\}"}; + std::string target{"{a}"}; + std::regex regex{re, std::regex::extended}; + std::smatch smatch; + assert((std::regex_match(target, smatch, regex))); +} + +void +test3() +{ + std::string re{"\\{a\\}"}; + std::string target{"{a}"}; + std::regex regex{re, std::regex::awk}; + std::smatch smatch; + assert((std::regex_match(target, smatch, regex))); +} + +void +test4() +{ + std::string re{"\\{a\\}"}; + std::string target{"{a}"}; + std::regex regex{re, std::regex::egrep}; + std::smatch smatch; + assert((std::regex_match(target, smatch, regex))); +} + +int +main() +{ + test1(); + test2(); + test3(); + test4(); +} |

