File tree Expand file tree Collapse file tree 11 files changed +37
-20
lines changed
libcxx/test/std/input.output/filesystems/class.path Expand file tree Collapse file tree 11 files changed +37
-20
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ int main(int, char**) {
29
29
const path p (s);
30
30
path p2;
31
31
path& pref = (p2 = p);
32
- assert (p.native () == s);
33
- assert (p2.native () == s);
32
+ assert (p.string () == s);
33
+ assert (p2.string () == s);
34
34
assert (&pref == &p2);
35
35
36
36
return 0 ;
Original file line number Diff line number Diff line change @@ -29,13 +29,14 @@ int main(int, char**) {
29
29
const std::string s (" we really really really really really really really "
30
30
" really really long string so that we allocate" );
31
31
assert (globalMemCounter.checkOutstandingNewEq (1 ));
32
+ const fs::path::string_type ps (s.begin (), s.end ());
32
33
path p (s);
33
34
{
34
35
DisableAllocationGuard g;
35
36
path p2;
36
37
path& pref = (p2 = std::move (p));
37
- assert (p2.native () == s );
38
- assert (p.native () != s ); // Testing moved from state
38
+ assert (p2.native () == ps );
39
+ assert (p.native () != ps ); // Testing moved from state
39
40
assert (&pref == &p2);
40
41
}
41
42
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ int main(int, char**) {
28
28
const std::string s (" foo" );
29
29
const path p (s);
30
30
path p2 (p);
31
- assert (p.native () == s);
32
- assert (p2.native () == s);
31
+ assert (p.string () == s);
32
+ assert (p2.string () == s);
33
33
34
34
return 0 ;
35
35
}
Original file line number Diff line number Diff line change @@ -29,12 +29,13 @@ int main(int, char**) {
29
29
const std::string s (" we really really really really really really really "
30
30
" really really long string so that we allocate" );
31
31
assert (globalMemCounter.checkOutstandingNewEq (1 ));
32
+ const fs::path::string_type ps (s.begin (), s.end ());
32
33
path p (s);
33
34
{
34
35
DisableAllocationGuard g;
35
36
path p2 (std::move (p));
36
- assert (p2.native () == s );
37
- assert (p.native () != s ); // Testing moved from state
37
+ assert (p2.native () == ps );
38
+ assert (p.native () != ps ); // Testing moved from state
38
39
}
39
40
40
41
return 0 ;
Original file line number Diff line number Diff line change 31
31
template <class CharT , class ...Args>
32
32
void RunTestCaseImpl (MultiStringType const & MS, Args... args) {
33
33
using namespace fs ;
34
- const char * Expect = MS;
34
+ const fs::path::value_type * Expect = MS;
35
35
const CharT* TestPath = MS;
36
36
const CharT* TestPathEnd = StrEnd (TestPath);
37
37
const std::size_t Size = TestPathEnd - TestPath;
Original file line number Diff line number Diff line change @@ -28,14 +28,15 @@ int main(int, char**)
28
28
using namespace fs ;
29
29
const char * const value = " hello world" ;
30
30
const std::string str_value = value;
31
+ const fs::path::string_type pathstr_value (str_value.begin (), str_value.end ());
31
32
{ // Check signature
32
33
path p (value);
33
34
ASSERT_SAME_TYPE (path::value_type const *, decltype (p.c_str ()));
34
35
ASSERT_NOEXCEPT (p.c_str ());
35
36
}
36
37
{
37
38
path p (value);
38
- assert (p.c_str () == str_value );
39
+ assert (p.c_str () == pathstr_value );
39
40
assert (p.native ().c_str () == p.c_str ());
40
41
}
41
42
Original file line number Diff line number Diff line change @@ -26,14 +26,16 @@ int main(int, char**)
26
26
{
27
27
using namespace fs ;
28
28
const char * const value = " hello world" ;
29
+ std::string value_str (value);
30
+ fs::path::string_type pathstr_value (value_str.begin (), value_str.end ());
29
31
{ // Check signature
30
32
path p (value);
31
33
ASSERT_SAME_TYPE (path::string_type const &, decltype (p.native ()));
32
34
ASSERT_NOEXCEPT (p.native ());
33
35
}
34
36
{ // native() is tested elsewhere
35
37
path p (value);
36
- assert (p.native () == value );
38
+ assert (p.native () == pathstr_value );
37
39
}
38
40
39
41
return 0 ;
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ int main(int, char**)
28
28
using namespace fs ;
29
29
using string_type = path::string_type;
30
30
const char * const value = " hello world" ;
31
+ std::string value_str (value);
32
+ fs::path::string_type pathstr_value (value_str.begin (), value_str.end ());
31
33
{ // Check signature
32
34
path p (value);
33
35
static_assert (std::is_convertible<path, string_type>::value, " " );
@@ -37,10 +39,10 @@ int main(int, char**)
37
39
}
38
40
{
39
41
path p (value);
40
- assert (p.native () == value );
42
+ assert (p.native () == pathstr_value );
41
43
string_type s = p;
42
- assert (s == value );
43
- assert (p == value );
44
+ assert (s == pathstr_value );
45
+ assert (p == pathstr_value );
44
46
}
45
47
46
48
return 0 ;
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ void doIOTest() {
53
53
{ // test input
54
54
path p_in;
55
55
auto & ret = ss >> p_in;
56
- assert (p_in.native () == (const char *)InStr);
56
+ assert (p_in.native () == (const path::value_type *)InStr);
57
57
assert (&ret == &ss);
58
58
}
59
59
}
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ int main(int, char**)
29
29
const char * value2 = " _THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG_THIS_IS_LONG" ;
30
30
path p1 (value1);
31
31
path p2 (value2);
32
+ fs::path::string_type ps1 = p1.native ();
33
+ fs::path::string_type ps2 = p2.native ();
32
34
{
33
35
using namespace std ; using namespace fs ;
34
36
ASSERT_NOEXCEPT (swap (p1, p2));
@@ -39,11 +41,11 @@ int main(int, char**)
39
41
using namespace std ;
40
42
using namespace fs ;
41
43
swap (p1, p2);
42
- assert (p1.native () == value2 );
43
- assert (p2.native () == value1 );
44
+ assert (p1.native () == ps2 );
45
+ assert (p2.native () == ps1 );
44
46
swap (p1, p2);
45
- assert (p1.native () == value1 );
46
- assert (p2.native () == value2 );
47
+ assert (p1.native () == ps1 );
48
+ assert (p2.native () == ps2 );
47
49
}
48
50
49
51
return 0 ;
Original file line number Diff line number Diff line change 25
25
26
26
int main (int , char **) {
27
27
using namespace fs ;
28
+ #ifdef _WIN32
29
+ ASSERT_SAME_TYPE (path::value_type, wchar_t );
30
+ #else
28
31
ASSERT_SAME_TYPE (path::value_type, char );
32
+ #endif
29
33
ASSERT_SAME_TYPE (path::string_type, std::basic_string<path::value_type>);
30
34
{
31
35
ASSERT_SAME_TYPE (const path::value_type, decltype (path::preferred_separator));
36
+ #ifdef _WIN32
37
+ static_assert (path::preferred_separator == ' \\ ' , " " );
38
+ #else
32
39
static_assert (path::preferred_separator == ' /' , " " );
40
+ #endif
33
41
// Make preferred_separator ODR used by taking its address.
34
- const char * dummy = &path::preferred_separator;
42
+ const path::value_type * dummy = &path::preferred_separator;
35
43
((void )dummy);
36
44
}
37
45
You can’t perform that action at this time.
0 commit comments