diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
| commit | 53a420fba21cf1644972b34dcd811a43cdb8368d (patch) | |
| tree | 66a19f6f8b65215772549a51d688492ab8addc0d /test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp | |
| parent | b50f1549701eb950921e5d6f2e55ba1a1dadbb43 (diff) | |
Notes
Diffstat (limited to 'test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp')
| -rw-r--r-- | test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp index d89e7c815efb..a04f35af5780 100644 --- a/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp +++ b/test/std/experimental/filesystem/class.path/path.member/path.construct/source.pass.cpp @@ -47,6 +47,13 @@ void RunTestCase(MultiStringType const& MS) { assert(p.string<CharT>() == TestPath); assert(p.string<CharT>() == S); } + { + const std::basic_string_view<CharT> S(TestPath); + path p(S); + assert(p.native() == Expect); + assert(p.string<CharT>() == TestPath); + assert(p.string<CharT>() == S); + } // Char* pointers { path p(TestPath); @@ -73,6 +80,37 @@ void RunTestCase(MultiStringType const& MS) { } } +void test_sfinae() { + using namespace fs; + { + using It = const char* const; + static_assert(std::is_constructible<path, It>::value, ""); + } + { + using It = input_iterator<const char*>; + static_assert(std::is_constructible<path, It>::value, ""); + } + { + struct Traits { + using iterator_category = std::input_iterator_tag; + using value_type = const char; + using pointer = const char*; + using reference = const char&; + using difference_type = std::ptrdiff_t; + }; + using It = input_iterator<const char*, Traits>; + static_assert(std::is_constructible<path, It>::value, ""); + } + { + using It = output_iterator<const char*>; + static_assert(!std::is_constructible<path, It>::value, ""); + + } + { + static_assert(!std::is_constructible<path, int*>::value, ""); + } +} + int main() { for (auto const& MS : PathList) { RunTestCase<char>(MS); @@ -80,4 +118,5 @@ int main() { RunTestCase<char16_t>(MS); RunTestCase<char32_t>(MS); } + test_sfinae(); } |
