diff options
author | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2014-12-20 01:40:03 +0000 |
commit | 5a83710e371fe68a06e6e3876c6a2c8b820a8976 (patch) | |
tree | afde4c82ad6704681781c5cd49baa3fbd05c85db /libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members | |
parent | f11e8eab527fba316c64112f6e05de1a79693a3e (diff) | |
download | bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.tar.gz bcm5719-llvm-5a83710e371fe68a06e6e3876c6a2c8b820a8976.zip |
Move test into test/std subdirectory.
llvm-svn: 224658
Diffstat (limited to 'libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members')
6 files changed, 180 insertions, 0 deletions
diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code.pass.cpp new file mode 100644 index 00000000000..c059ba3253c --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <system_error> + +// class system_error + +// system_error(error_code ec); + +// Test is slightly non-portable + +#include <system_error> +#include <string> +#include <cassert> + +int main() +{ + std::system_error se(static_cast<int>(std::errc::not_a_directory), + std::generic_category(), "some text"); + assert(se.code() == std::make_error_code(std::errc::not_a_directory)); + std::string what_message(se.what()); + assert(what_message.find("Not a directory") != std::string::npos); +} diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_const_char_pointer.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_const_char_pointer.pass.cpp new file mode 100644 index 00000000000..cd8e3fefbf9 --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_const_char_pointer.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <system_error> + +// class system_error + +// system_error(error_code ec, const char* what_arg); + +// Test is slightly non-portable + +#include <system_error> +#include <string> +#include <cassert> + +int main() +{ + std::string what_arg("test message"); + std::system_error se(make_error_code(std::errc::not_a_directory), what_arg.c_str()); + assert(se.code() == std::make_error_code(std::errc::not_a_directory)); + std::string what_message(se.what()); + assert(what_message.find(what_arg) != std::string::npos); + assert(what_message.find("Not a directory") != std::string::npos); +} diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp new file mode 100644 index 00000000000..b891a6d973d --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_error_code_string.pass.cpp @@ -0,0 +1,30 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <system_error> + +// class system_error + +// system_error(error_code ec, const string& what_arg); + +// Test is slightly non-portable + +#include <system_error> +#include <string> +#include <cassert> + +int main() +{ + std::string what_arg("test message"); + std::system_error se(make_error_code(std::errc::not_a_directory), what_arg); + assert(se.code() == std::make_error_code(std::errc::not_a_directory)); + std::string what_message(se.what()); + assert(what_message.find(what_arg) != std::string::npos); + assert(what_message.find("Not a directory") != std::string::npos); +} diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category.pass.cpp new file mode 100644 index 00000000000..acf6387fc24 --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category.pass.cpp @@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <system_error> + +// class system_error + +// system_error(int ev, const error_category& ecat); + +// Test is slightly non-portable + +#include <system_error> +#include <string> +#include <cassert> + +int main() +{ + std::system_error se(static_cast<int>(std::errc::not_a_directory), + std::generic_category()); + assert(se.code() == std::make_error_code(std::errc::not_a_directory)); + std::string what_message(se.what()); + assert(what_message.find("Not a directory") != std::string::npos); +} diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_const_char_pointer.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_const_char_pointer.pass.cpp new file mode 100644 index 00000000000..4f697016ce1 --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_const_char_pointer.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <system_error> + +// class system_error + +// system_error(int ev, const error_category& ecat, const char* what_arg); + +// Test is slightly non-portable + +#include <system_error> +#include <string> +#include <cassert> + +int main() +{ + std::string what_arg("test message"); + std::system_error se(static_cast<int>(std::errc::not_a_directory), + std::generic_category(), what_arg.c_str()); + assert(se.code() == std::make_error_code(std::errc::not_a_directory)); + std::string what_message(se.what()); + assert(what_message.find(what_arg) != std::string::npos); + assert(what_message.find("Not a directory") != std::string::npos); +} diff --git a/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp new file mode 100644 index 00000000000..87814b19079 --- /dev/null +++ b/libcxx/test/std/diagnostics/syserr/syserr.syserr/syserr.syserr.members/ctor_int_error_category_string.pass.cpp @@ -0,0 +1,31 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// <system_error> + +// class system_error + +// system_error(int ev, const error_category& ecat, const string& what_arg); + +// Test is slightly non-portable + +#include <system_error> +#include <string> +#include <cassert> + +int main() +{ + std::string what_arg("test message"); + std::system_error se(static_cast<int>(std::errc::not_a_directory), + std::generic_category(), what_arg); + assert(se.code() == std::make_error_code(std::errc::not_a_directory)); + std::string what_message(se.what()); + assert(what_message.find(what_arg) != std::string::npos); + assert(what_message.find("Not a directory") != std::string::npos); +} |