summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/27_io/filesystem/path
diff options
context:
space:
mode:
authorTom Honermann <tom@honermann.net>2019-02-19 02:55:05 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-02-19 02:55:05 +0000
commit46ca1dd73c97c5bf85057d450adf4b885a427e77 (patch)
treebb7dac034e30fbbe342d837c64f61962be6db738 /libstdc++-v3/testsuite/27_io/filesystem/path
parentc124af936b6b225eb548ccdd7f01400511d784dc (diff)
P0482R5 char8_t: New standard library tests
2019-02-19 Tom Honermann <tom@honermann.net> * testsuite/18_support/numeric_limits/char8_t.cc: New test cloned from char16_32_t.cc; validates numeric_limits<char8_t>. * testsuite/21_strings/basic_string/literals/types-char8_t.cc: New test cloned from types.cc; validates operator""s for char8_t returns u8string. * testsuite/21_strings/basic_string/literals/values-char8_t.cc: New test cloned from values.cc; validates construction and comparison of u8string values. * testsuite/21_strings/basic_string/requirements/ /explicit_instantiation/char8_t/1.cc: New test cloned from char16_t/1.cc; validates explicit instantiation of basic_string<char8_t>. * testsuite/21_strings/basic_string_view/literals/types-char8_t.cc: New test cloned from types.cc; validates operator""sv for char8_t returns u8string_view. * testsuite/21_strings/basic_string_view/literals/ values-char8_t.cc: New test cloned from values.cc; validates construction and comparison of u8string_view values. * testsuite/21_strings/basic_string_view/requirements/ explicit_instantiation/char8_t/1.cc: New test cloned from char16_t/1.cc; validates explicit instantiation of basic_string_view<char8_t>. * testsuite/21_strings/char_traits/requirements/char8_t/65049.cc: New test cloned from char16_t/65049.cc; validates that char_traits<char8_t> is not vulnerable to the concerns in PR65049. * testsuite/21_strings/char_traits/requirements/char8_t/ typedefs.cc: New test cloned from char16_t/typedefs.cc; validates that char_traits<char8_t> member typedefs are present and correct. * testsuite/21_strings/char_traits/requirements/ explicit_instantiation/char8_t/1.cc: New test cloned from char16_t/1.cc; validates explicit instantiation of char_traits<char8_t>. * testsuite/22_locale/codecvt/char16_t-char8_t.cc: New test cloned from char16_t.cc: validates codecvt<char16_t, char8_t, mbstate_t>. * testsuite/22_locale/codecvt/char32_t-char8_t.cc: New test cloned from char32_t.cc: validates codecvt<char32_t, char8_t, mbstate_t>. * testsuite/22_locale/codecvt/utf8-char8_t.cc: New test cloned from utf8.cc; validates codecvt<char16_t, char8_t, std::mbstate_t> and codecvt<char32_t, char8_t, std::mbstate_t>. * testsuite/27_io/filesystem/path/native/string-char8_t.cc: New test cloned from string.cc; validates filesystem::path construction from char8_t input. * testsuite/experimental/feat-char8_t.cc: New test; validates that the __cpp_lib_char8_t feature test macro is defined with the correct value. * testsuite/experimental/filesystem/path/native/string-char8_t.cc: New test cloned from string.cc; validates filesystem::path construction from char8_t input. * testsuite/experimental/string_view/literals/types-char8_t.cc: New test cloned from types.cc; validates operator""sv for char8_t returns u8string_view. * testsuite/experimental/string_view/literals/values-char8_t.cc: New test cloned from values.cc; validates construction and comparison of u8string_view values. * testsuite/experimental/string_view/requirements/ explicit_instantiation/char8_t/1.cc: New test cloned from char16_t/1.cc; validates explicit instantiation of basic_string_view<char8_t>. * testsuite/ext/char8_t/atomic-1.cc: New test; validates that ATOMIC_CHAR8_T_LOCK_FREE is not defined if char8_t support is not enabled. From-SVN: r269005
Diffstat (limited to 'libstdc++-v3/testsuite/27_io/filesystem/path')
-rw-r--r--libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc76
1 files changed, 76 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
new file mode 100644
index 00000000000..4f187da7804
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string-char8_t.cc
@@ -0,0 +1,76 @@
+// Copyright (C) 2016-2017 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/>.
+
+// { dg-options "-std=gnu++17 -lstdc++fs -fchar8_t" }
+// { dg-do run { target c++17 } }
+// { dg-require-filesystem-ts "" }
+
+#include <filesystem>
+#include <string>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ using namespace std::filesystem;
+ const std::string s = "abc";
+ path p(s);
+
+ VERIFY( p.native() == s );
+ VERIFY( p.c_str() == s );
+ VERIFY( static_cast<std::string>(p) == s );
+
+ std::string s2 = p; // implicit conversion
+ VERIFY( s2 == p.native() );
+}
+
+void
+test02()
+{
+ using namespace std::filesystem;
+ const char* s = "abc";
+ path p(s);
+
+ auto str = p.string<char>();
+ VERIFY( str == u"abc" );
+ VERIFY( str == p.string() );
+
+ auto strw = p.string<wchar_t>();
+ VERIFY( strw == L"abc" );
+ VERIFY( strw == p.wstring() );
+
+#ifdef _GLIBCXX_USE_CHAR8_T
+ auto str8 = p.string<char8_t>();
+ VERIFY( str8 == u8"abc" );
+ VERIFY( str8 == p.u8string() );
+#endif
+
+ auto str16 = p.string<char16_t>();
+ VERIFY( str16 == u"abc" );
+ VERIFY( str16 == p.u16string() );
+
+ auto str32 = p.string<char32_t>();
+ VERIFY( str32 == U"abc" );
+ VERIFY( str32 == p.u32string() );
+}
+
+int
+main()
+{
+ test01();
+ test02();
+}