summaryrefslogtreecommitdiffstats
path: root/libcxx/test/re/re.badexp/regex_error.pass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test/re/re.badexp/regex_error.pass.cpp')
-rw-r--r--libcxx/test/re/re.badexp/regex_error.pass.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/libcxx/test/re/re.badexp/regex_error.pass.cpp b/libcxx/test/re/re.badexp/regex_error.pass.cpp
new file mode 100644
index 00000000000..6145b8eae65
--- /dev/null
+++ b/libcxx/test/re/re.badexp/regex_error.pass.cpp
@@ -0,0 +1,91 @@
+// -*- C++ -*-
+//===-------------------------- algorithm ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <regex>
+
+// class regex_error
+// : public runtime_error
+// {
+// public:
+// explicit regex_error(regex_constants::error_type ecode);
+// regex_constants::error_type code() const;
+// };
+
+#include <regex>
+#include <cassert>
+
+int main()
+{
+ {
+ std::regex_error e(std::regex_constants::error_collate);
+ assert(e.code() == std::regex_constants::error_collate);
+ assert(e.what() == std::string("error_collate"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_ctype);
+ assert(e.code() == std::regex_constants::error_ctype);
+ assert(e.what() == std::string("error_ctype"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_escape);
+ assert(e.code() == std::regex_constants::error_escape);
+ assert(e.what() == std::string("error_escape"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_backref);
+ assert(e.code() == std::regex_constants::error_backref);
+ assert(e.what() == std::string("error_backref"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_brack);
+ assert(e.code() == std::regex_constants::error_brack);
+ assert(e.what() == std::string("error_brack"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_paren);
+ assert(e.code() == std::regex_constants::error_paren);
+ assert(e.what() == std::string("error_paren"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_brace);
+ assert(e.code() == std::regex_constants::error_brace);
+ assert(e.what() == std::string("error_brace"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_badbrace);
+ assert(e.code() == std::regex_constants::error_badbrace);
+ assert(e.what() == std::string("error_badbrace"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_range);
+ assert(e.code() == std::regex_constants::error_range);
+ assert(e.what() == std::string("error_range"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_space);
+ assert(e.code() == std::regex_constants::error_space);
+ assert(e.what() == std::string("error_space"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_badrepeat);
+ assert(e.code() == std::regex_constants::error_badrepeat);
+ assert(e.what() == std::string("error_badrepeat"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_complexity);
+ assert(e.code() == std::regex_constants::error_complexity);
+ assert(e.what() == std::string("error_complexity"));
+ }
+ {
+ std::regex_error e(std::regex_constants::error_stack);
+ assert(e.code() == std::regex_constants::error_stack);
+ assert(e.what() == std::string("error_stack"));
+ }
+}
OpenPOWER on IntegriCloud