summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma
diff options
context:
space:
mode:
authorTim Shen <timshen91@gmail.com>2013-08-27 02:49:22 +0000
committerTim Shen <timshen@gcc.gnu.org>2013-08-27 02:49:22 +0000
commit33fbbb766cde302f16aca2208e25610c11484388 (patch)
tree2152998d3b362b24cc7f901c04a1249d8fe40c68 /libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma
parentfd91cfe3e0a62ff045811a6dc2fcce2930eef0b3 (diff)
downloadgcc-33fbbb766cde302f16aca2208e25610c11484388.tar.gz
Makefile.am: Add regex_scanner.{h,tcc}.
2013-08-26 Tim Shen <timshen91@gmail.com> * include/Makefile.am: Add regex_scanner.{h,tcc}. * include/Makefile.in: Regenerate. * include/bits/regex.h (match_search): Handle the `__first == __last` situation correctly. * include/bits/regex_compiler.h: Move _Scanner... * include/bits/regex_scanner.h: ...to here. New. * include/bits/regex_compiler.tcc: Move _Scanner... * include/bits/regex_scanner.tcc: ...to here, too. New. * include/bits/regex_executor.tcc: Use value instead of reference for submatch. * include/std/regex: Add regex_scanner.h * testsuite/28_regex/algorithms/regex_match/awk/cstring_01.cc: New. * testsuite/28_regex/algorithms/regex_match/basic/empty_range.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc: New. * testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc: New. * testsuite/28_regex/algorithms/regex_search/ecma/string_01.cc: New. From-SVN: r202015
Diffstat (limited to 'libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma')
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc54
-rw-r--r--libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc47
2 files changed, 101 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc
new file mode 100644
index 00000000000..a7ef0fb36cc
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/cstring_hex.cc
@@ -0,0 +1,54 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-08-26 Tim Shen <timshen91@gmail.com>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ECMAScript \x and \u.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY(regex_match(":", regex("\\x3a")));
+ VERIFY(regex_match(L"\u1234", wregex(L"\\u1234")));
+ try
+ {
+ regex("\\u400x");
+ VERIFY(false);
+ }
+ catch (...)
+ {
+ VERIFY(true);
+ }
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc
new file mode 100644
index 00000000000..93bca45bf9d
--- /dev/null
+++ b/libstdc++-v3/testsuite/28_regex/algorithms/regex_match/ecma/empty_range.cc
@@ -0,0 +1,47 @@
+// { dg-options "-std=gnu++11" }
+
+//
+// 2013-08-26 Tim Shen <timshen91@gmail.com>
+//
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// 28.11.2 regex_match
+// Tests ECMAScript empty range.
+
+#include <regex>
+#include <testsuite_hooks.h>
+
+using namespace std;
+
+void
+test01()
+{
+ bool test __attribute__((unused)) = true;
+
+ VERIFY(!regex_match("x", regex("[]")));
+ VERIFY(regex_match("x", regex("[^]")));
+ VERIFY(!regex_match("]", regex("[]]")));
+ VERIFY(!regex_match("]", regex("[^]]")));
+}
+
+int
+main()
+{
+ test01();
+ return 0;
+}