]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/filesystem/path/construct/locale.cc
1 // { dg-options "-std=gnu++17" }
2 // { dg-do run { target c++17 } }
4 // Copyright (C) 2014-2021 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
21 // 30.10.7.4.1 path constructors [fs.path.construct]
24 #include <testsuite_hooks.h>
25 #include <testsuite_iterators.h>
27 using std::filesystem::path
;
32 path
p("/foo/bar", std::locale::classic());
33 #if defined(__MINGW32__) || defined(__MINGW64__)
34 VERIFY( p
.native() == L
"/foo/bar" );
36 VERIFY( p
.native() == "/foo/bar" );
43 using __gnu_test::test_container
;
44 using __gnu_test::input_iterator_wrapper
;
45 // Test with input iterators and const value_types
47 const std::locale loc
;
48 const std::string s
= "foo/bar/";
51 test_container
<char, input_iterator_wrapper
>
52 r1((char*)s
.c_str(), (char*)s
.c_str() + s
.size());
53 path
p1(r1
.begin(), r1
.end(), loc
);
56 test_container
<char, input_iterator_wrapper
>
57 r2((char*)s
.c_str(), (char*)s
.c_str() + s
.size() + 1); // includes null-terminator
58 path
p2(r2
.begin(), loc
);
61 test_container
<const char, input_iterator_wrapper
>
62 r3(s
.c_str(), s
.c_str() + s
.size());
63 path
p3(r3
.begin(), r3
.end(), loc
);
66 test_container
<const char, input_iterator_wrapper
>
67 r4(s
.c_str(), s
.c_str() + s
.size() + 1); // includes null-terminator
68 path
p4(r4
.begin(), loc
);