From b5cfe95696c60d383f41fdf477eec498ecefa22f Mon Sep 17 00:00:00 2001 From: Beman Date: Wed, 20 Aug 2014 16:12:10 -0400 Subject: [PATCH] is_iterator dispatch working. Unstable work-in-progress. --- include/boost/filesystem/config.hpp | 4 + include/boost/filesystem/path.hpp | 58 + include/boost/filesystem/path_traits.hpp | 21 +- test/issues/hello_filesystem.cpp | 7 +- test/path_unit_test.cpp | 1386 +++++++++++----------- 5 files changed, 779 insertions(+), 697 deletions(-) diff --git a/include/boost/filesystem/config.hpp b/include/boost/filesystem/config.hpp index ca695f4..0be66ed 100644 --- a/include/boost/filesystem/config.hpp +++ b/include/boost/filesystem/config.hpp @@ -12,6 +12,10 @@ #ifndef BOOST_FILESYSTEM3_CONFIG_HPP #define BOOST_FILESYSTEM3_CONFIG_HPP +// during initial development on a branch, defining BOOST_FILESYSTEM_TS here is fast and easy +#define BOOST_FILESYSTEM_TS + + # if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 # error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3 # endif diff --git a/include/boost/filesystem/path.hpp b/include/boost/filesystem/path.hpp index f7bafb3..fafa632 100644 --- a/include/boost/filesystem/path.hpp +++ b/include/boost/filesystem/path.hpp @@ -1,3 +1,11 @@ +/* TODO: + + * What was the purpose of is_pathable? Is it still needed? If so, it needs to be generalized. + If Source is an iterator or container with a value_type of one of the encoded character types + then it is OK. See C:\boost\trunk-ex\libs\interop\include\boost\interop\detail\iterator_value.hpp + for workarounds for some issues. + +*/ // filesystem path.hpp ---------------------------------------------------------------// // Copyright Beman Dawes 2002-2005, 2009 @@ -31,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -40,6 +49,8 @@ #include #include +#include + #include // must be the last #include namespace boost @@ -131,11 +142,15 @@ namespace filesystem path(const path& p) : m_pathname(p.m_pathname) {} +#ifndef BOOST_FILESYSTEM_TS + // --- traditional signatures -- + template path(Source const& source, typename boost::enable_if::type> >::type* =0) { + path_traits::dispatch(source, m_pathname, codecvt()); } @@ -180,7 +195,23 @@ namespace filesystem path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); } } +#else + // --- ISO Technical Specification signatures -- + template + path(const Source& source) + { + detail::append(source, m_pathname, + typename path_traits::source_tag::type>::type()); + } + + template + path(InputIterator first, InputIterator last) + { + detail::append(first, last, m_pathname); + } + +#endif // ----- assignments ----- path& operator=(const path& p) @@ -757,6 +788,33 @@ namespace filesystem std::wstring path::generic_string(const codecvt_type& cvt) const { return generic_wstring(cvt); } +#ifdef BOOST_FILESYSTEM_TS +namespace detail +{ + template + void append(const Source& from, path::string_type& to, path_traits::iterator_source_tag) + { + std::cout << "*** append from iterator" << std::endl; + } + + template + void append(const Source& from, path::string_type& to, path_traits::container_source_tag) + { + std::cout << "***" << boost::is_iterator::value << std::endl; + std::cout << "*** append from container" << std::endl; + } + + template + void append(InputIterator first, InputIterator last, path::string_type& to) + { + std::cout << "***" << boost::is_iterator::value << std::endl; + std::cout << "*** append from range" << std::endl; + } + +} // namesapce detail + +#endif + } // namespace filesystem } // namespace boost diff --git a/include/boost/filesystem/path_traits.hpp b/include/boost/filesystem/path_traits.hpp index a6a2505..86d9ef7 100644 --- a/include/boost/filesystem/path_traits.hpp +++ b/include/boost/filesystem/path_traits.hpp @@ -19,8 +19,8 @@ #include #include #include -#include #include +#include #include // for mbstate_t #include #include @@ -227,6 +227,25 @@ namespace path_traits { # endif const codecvt_type&); +//------------------------------------ TS helpers -------------------------------------// + +#ifdef BOOST_FILESYSTEM_TS + + struct iterator_source_tag {}; + struct container_source_tag {}; + + template + struct source_tag_helper; + template<> struct source_tag_helper { typedef iterator_source_tag type; }; + template<> struct source_tag_helper { typedef container_source_tag type; }; + + template + struct source_tag + { + typedef typename source_tag_helper::type>::type type; + }; + +#endif }}} // namespace boost::filesystem::path_traits diff --git a/test/issues/hello_filesystem.cpp b/test/issues/hello_filesystem.cpp index f98b2f7..24019df 100644 --- a/test/issues/hello_filesystem.cpp +++ b/test/issues/hello_filesystem.cpp @@ -16,10 +16,8 @@ //--------------------------------------------------------------------------------------// #include - -#include - #include +#include #include #include @@ -33,6 +31,9 @@ int cpp_main(int argc, char* argv[]) { cout << "Hello, filesystem world" << endl; + const char* p = "."; + + BOOST_TEST(fs::exists(p)); BOOST_TEST(fs::exists(".")); return ::boost::report_errors(); diff --git a/test/path_unit_test.cpp b/test/path_unit_test.cpp index 67ccb9f..25684e6 100644 --- a/test/path_unit_test.cpp +++ b/test/path_unit_test.cpp @@ -241,345 +241,381 @@ namespace path x; path y; - // test_assignments ----------------------------------------------------------------// - - void test_assignments() - { - std::cout << "testing assignments..." << std::endl; - - x = path("yet another path"); // another path - PATH_IS(x, L"yet another path"); - BOOST_TEST_EQ(x.native().size(), 16U); - - x = x; // self-assignment - PATH_IS(x, L"yet another path"); - BOOST_TEST_EQ(x.native().size(), 16U); - - x.assign(l.begin(), l.end()); // iterator range char - PATH_IS(x, L"string"); - - x.assign(wl.begin(), wl.end()); // iterator range wchar_t - PATH_IS(x, L"wstring"); - - x = string("std::string"); // container char - PATH_IS(x, L"std::string"); - - x = wstring(L"std::wstring"); // container wchar_t - PATH_IS(x, L"std::wstring"); - - x = "array char"; // array char - PATH_IS(x, L"array char"); - - x = L"array wchar"; // array wchar_t - PATH_IS(x, L"array wchar"); - - x = s.c_str(); // const char* null terminated - PATH_IS(x, L"string"); - - x = ws.c_str(); // const wchar_t* null terminated - PATH_IS(x, L"wstring"); - } - - // test_appends --------------------------------------------------------------------// - - void test_appends() - { - std::cout << "testing appends..." << std::endl; - -# ifdef BOOST_WINDOWS_API -# define BOOST_FS_FOO L"/foo\\" -# else // POSIX paths -# define BOOST_FS_FOO L"/foo/" -# endif - - x = "/foo"; - x /= path(""); // empty path - PATH_IS(x, L"/foo"); - - x = "/foo"; - x /= path("/"); // slash path - PATH_IS(x, L"/foo/"); - - x = "/foo"; - x /= path("/boo"); // slash path - PATH_IS(x, L"/foo/boo"); - - x = "/foo"; - x /= x; // self-append - PATH_IS(x, L"/foo/foo"); - - x = "/foo"; - x /= path("yet another path"); // another path - PATH_IS(x, BOOST_FS_FOO L"yet another path"); - - x = "/foo"; - x.append(l.begin(), l.end()); // iterator range char - PATH_IS(x, BOOST_FS_FOO L"string"); - - x = "/foo"; - x.append(wl.begin(), wl.end()); // iterator range wchar_t - PATH_IS(x, BOOST_FS_FOO L"wstring"); - - x = "/foo"; - x /= string("std::string"); // container char - PATH_IS(x, BOOST_FS_FOO L"std::string"); - - x = "/foo"; - x /= wstring(L"std::wstring"); // container wchar_t - PATH_IS(x, BOOST_FS_FOO L"std::wstring"); - - x = "/foo"; - x /= "array char"; // array char - PATH_IS(x, BOOST_FS_FOO L"array char"); - - x = "/foo"; - x /= L"array wchar"; // array wchar_t - PATH_IS(x, BOOST_FS_FOO L"array wchar"); - - x = "/foo"; - x /= s.c_str(); // const char* null terminated - PATH_IS(x, BOOST_FS_FOO L"string"); - - x = "/foo"; - x /= ws.c_str(); // const wchar_t* null terminated - PATH_IS(x, BOOST_FS_FOO L"wstring"); - } - - // test_concats --------------------------------------------------------------------// - - void test_concats() - { - std::cout << "testing concats..." << std::endl; - - x = "/foo"; - x += path(""); // empty path - PATH_IS(x, L"/foo"); - - x = "/foo"; - x += path("/"); // slash path - PATH_IS(x, L"/foo/"); - - x = "/foo"; - x += path("boo"); // slash path - PATH_IS(x, L"/fooboo"); - - x = "foo"; - x += x; // self-append - PATH_IS(x, L"foofoo"); - - x = "foo-"; - x += path("yet another path"); // another path - PATH_IS(x, L"foo-yet another path"); - - x = "foo-"; - x.concat(l.begin(), l.end()); // iterator range char - PATH_IS(x, L"foo-string"); - - x = "foo-"; - x.concat(wl.begin(), wl.end()); // iterator range wchar_t - PATH_IS(x, L"foo-wstring"); - - x = "foo-"; - x += string("std::string"); // container char - PATH_IS(x, L"foo-std::string"); - - x = "foo-"; - x += wstring(L"std::wstring"); // container wchar_t - PATH_IS(x, L"foo-std::wstring"); - - x = "foo-"; - x += "array char"; // array char - PATH_IS(x, L"foo-array char"); - - x = "foo-"; - x += L"array wchar"; // array wchar_t - PATH_IS(x, L"foo-array wchar"); - - x = "foo-"; - x += s.c_str(); // const char* null terminated - PATH_IS(x, L"foo-string"); - - x = "foo-"; - x += ws.c_str(); // const wchar_t* null terminated - PATH_IS(x, L"foo-wstring"); - - x = "foo-"; - x += 'x'; // char - PATH_IS(x, L"foo-x"); - - x = "foo-"; - x += L'x'; // wchar - PATH_IS(x, L"foo-x"); - } - - // test_observers ------------------------------------------------------------------// - - void test_observers() - { - std::cout << "testing observers..." << std::endl; - - path p0("abc"); - - CHECK(p0.native().size() == 3); - CHECK(p0.string() == "abc"); - CHECK(p0.string().size() == 3); - CHECK(p0.wstring() == L"abc"); - CHECK(p0.wstring().size() == 3); - -# ifdef BOOST_WINDOWS_API - - path p("abc\\def/ghi"); - - CHECK(std::wstring(p.c_str()) == L"abc\\def/ghi"); - - CHECK(p.string() == "abc\\def/ghi"); - CHECK(p.wstring() == L"abc\\def/ghi"); - - CHECK(p.generic_string() == "abc/def/ghi"); - CHECK(p.generic_wstring() == L"abc/def/ghi"); - - CHECK(p.generic_string() == "abc/def/ghi"); - CHECK(p.generic_string() == L"abc/def/ghi"); - CHECK(p.generic_string() == L"abc/def/ghi"); - -# else // BOOST_POSIX_API - - path p("abc\\def/ghi"); - - CHECK(string(p.c_str()) == "abc\\def/ghi"); - - CHECK(p.string() == "abc\\def/ghi"); - CHECK(p.wstring() == L"abc\\def/ghi"); - - CHECK(p.generic_string() == "abc\\def/ghi"); - CHECK(p.generic_wstring() == L"abc\\def/ghi"); - - CHECK(p.generic_string() == "abc\\def/ghi"); - CHECK(p.generic_string() == L"abc\\def/ghi"); - CHECK(p.generic_string() == "abc\\def/ghi"); - -# endif - } - - // test_relationals ----------------------------------------------------------------// - - void test_relationals() - { - std::cout << "testing relationals..." << std::endl; - - boost::hash hash; - -# ifdef BOOST_WINDOWS_API - // this is a critical use case to meet user expectations - CHECK(path("c:\\abc") == path("c:/abc")); - CHECK(hash(path("c:\\abc")) == hash(path("c:/abc"))); -# endif - - const path p("bar"); - const path p2("baz"); - - CHECK(!(p < p)); - CHECK(p < p2); - CHECK(!(p2 < p)); - CHECK(p < "baz"); - CHECK(p < string("baz")); - CHECK(p < L"baz"); - CHECK(p < wstring(L"baz")); - CHECK(!("baz" < p)); - CHECK(!(string("baz") < p)); - CHECK(!(L"baz" < p)); - CHECK(!(wstring(L"baz") < p)); - - CHECK(p == p); - CHECK(!(p == p2)); - CHECK(!(p2 == p)); - CHECK(p2 == "baz"); - CHECK(p2 == string("baz")); - CHECK(p2 == L"baz"); - CHECK(p2 == wstring(L"baz")); - CHECK("baz" == p2); - CHECK(string("baz") == p2); - CHECK(L"baz" == p2); - CHECK(wstring(L"baz") == p2); - - CHECK(hash(p) == hash(p)); - CHECK(hash(p) != hash(p2)); // Not strictly required, but desirable - - CHECK(!(p != p)); - CHECK(p != p2); - CHECK(p2 != p); - - CHECK(p <= p); - CHECK(p <= p2); - CHECK(!(p2 <= p)); - - CHECK(!(p > p)); - CHECK(!(p > p2)); - CHECK(p2 > p); - - CHECK(p >= p); - CHECK(!(p >= p2)); - CHECK(p2 >= p); -} - - // test_inserter_and_extractor -----------------------------------------------------// - - void test_inserter_and_extractor() - { - std::cout << "testing inserter and extractor..." << std::endl; - - path p1("foo bar"); // verify space in path roundtrips per ticket #3863 - path p2; - - std::stringstream ss; - - CHECK(p1 != p2); - ss << p1; - ss >> p2; - CHECK(p1 == p2); - - path wp1(L"foo bar"); - path wp2; - - std::wstringstream wss; - - CHECK(wp1 != wp2); - wss << wp1; - wss >> wp2; - CHECK(wp1 == wp2); - } - - // test_other_non_members ----------------------------------------------------------// - - void test_other_non_members() - { - std::cout << "testing other_non_members..." << std::endl; - - path p1("foo"); - path p2("bar"); - - // operator / - - CHECK(p1 / p2 == path("foo/bar").make_preferred()); - CHECK("foo" / p2 == path("foo/bar").make_preferred()); - CHECK(L"foo" / p2 == path("foo/bar").make_preferred()); - CHECK(string("foo") / p2 == path("foo/bar").make_preferred()); - CHECK(wstring(L"foo") / p2 == path("foo/bar").make_preferred()); - CHECK(p1 / "bar" == path("foo/bar").make_preferred()); - CHECK(p1 / L"bar" == path("foo/bar").make_preferred()); - CHECK(p1 / string("bar") == path("foo/bar").make_preferred()); - CHECK(p1 / wstring(L"bar") == path("foo/bar").make_preferred()); - - swap(p1, p2); - - CHECK(p1 == "bar"); - CHECK(p2 == "foo"); - - CHECK(path("").remove_filename() == ""); - CHECK(path("foo").remove_filename() == ""); - CHECK(path("foo/bar").remove_filename() == "foo"); - } - +// // test_assignments ----------------------------------------------------------------// +// +// void test_assignments() +// { +// std::cout << "testing assignments..." << std::endl; +// +// x = path("yet another path"); // another path +// PATH_IS(x, L"yet another path"); +// BOOST_TEST_EQ(x.native().size(), 16U); +// +// x = x; // self-assignment +// PATH_IS(x, L"yet another path"); +// BOOST_TEST_EQ(x.native().size(), 16U); +// +// x.assign(l.begin(), l.end()); // iterator range char +// PATH_IS(x, L"string"); +// +// x.assign(wl.begin(), wl.end()); // iterator range wchar_t +// PATH_IS(x, L"wstring"); +// +// x = string("std::string"); // container char +// PATH_IS(x, L"std::string"); +// +// x = wstring(L"std::wstring"); // container wchar_t +// PATH_IS(x, L"std::wstring"); +// +// x = "array char"; // array char +// PATH_IS(x, L"array char"); +// +// x = L"array wchar"; // array wchar_t +// PATH_IS(x, L"array wchar"); +// +// x = s.c_str(); // const char* null terminated +// PATH_IS(x, L"string"); +// +// x = ws.c_str(); // const wchar_t* null terminated +// PATH_IS(x, L"wstring"); +// } +// +// // test_appends --------------------------------------------------------------------// +// +// void test_appends() +// { +// std::cout << "testing appends..." << std::endl; +// +//# ifdef BOOST_WINDOWS_API +//# define BOOST_FS_FOO L"/foo\\" +//# else // POSIX paths +//# define BOOST_FS_FOO L"/foo/" +//# endif +// +// x = "/foo"; +// x /= path(""); // empty path +// PATH_IS(x, L"/foo"); +// +// x = "/foo"; +// x /= path("/"); // slash path +// PATH_IS(x, L"/foo/"); +// +// x = "/foo"; +// x /= path("/boo"); // slash path +// PATH_IS(x, L"/foo/boo"); +// +// x = "/foo"; +// x /= x; // self-append +// PATH_IS(x, L"/foo/foo"); +// +// x = "/foo"; +// x /= path("yet another path"); // another path +// PATH_IS(x, BOOST_FS_FOO L"yet another path"); +// +// x = "/foo"; +// x.append(l.begin(), l.end()); // iterator range char +// PATH_IS(x, BOOST_FS_FOO L"string"); +// +// x = "/foo"; +// x.append(wl.begin(), wl.end()); // iterator range wchar_t +// PATH_IS(x, BOOST_FS_FOO L"wstring"); +// +// x = "/foo"; +// x /= string("std::string"); // container char +// PATH_IS(x, BOOST_FS_FOO L"std::string"); +// +// x = "/foo"; +// x /= wstring(L"std::wstring"); // container wchar_t +// PATH_IS(x, BOOST_FS_FOO L"std::wstring"); +// +// x = "/foo"; +// x /= "array char"; // array char +// PATH_IS(x, BOOST_FS_FOO L"array char"); +// +// x = "/foo"; +// x /= L"array wchar"; // array wchar_t +// PATH_IS(x, BOOST_FS_FOO L"array wchar"); +// +// x = "/foo"; +// x /= s.c_str(); // const char* null terminated +// PATH_IS(x, BOOST_FS_FOO L"string"); +// +// x = "/foo"; +// x /= ws.c_str(); // const wchar_t* null terminated +// PATH_IS(x, BOOST_FS_FOO L"wstring"); +// } +// +// // test_concats --------------------------------------------------------------------// +// +// void test_concats() +// { +// std::cout << "testing concats..." << std::endl; +// +// x = "/foo"; +// x += path(""); // empty path +// PATH_IS(x, L"/foo"); +// +// x = "/foo"; +// x += path("/"); // slash path +// PATH_IS(x, L"/foo/"); +// +// x = "/foo"; +// x += path("boo"); // slash path +// PATH_IS(x, L"/fooboo"); +// +// x = "foo"; +// x += x; // self-append +// PATH_IS(x, L"foofoo"); +// +// x = "foo-"; +// x += path("yet another path"); // another path +// PATH_IS(x, L"foo-yet another path"); +// +// x = "foo-"; +// x.concat(l.begin(), l.end()); // iterator range char +// PATH_IS(x, L"foo-string"); +// +// x = "foo-"; +// x.concat(wl.begin(), wl.end()); // iterator range wchar_t +// PATH_IS(x, L"foo-wstring"); +// +// x = "foo-"; +// x += string("std::string"); // container char +// PATH_IS(x, L"foo-std::string"); +// +// x = "foo-"; +// x += wstring(L"std::wstring"); // container wchar_t +// PATH_IS(x, L"foo-std::wstring"); +// +// x = "foo-"; +// x += "array char"; // array char +// PATH_IS(x, L"foo-array char"); +// +// x = "foo-"; +// x += L"array wchar"; // array wchar_t +// PATH_IS(x, L"foo-array wchar"); +// +// x = "foo-"; +// x += s.c_str(); // const char* null terminated +// PATH_IS(x, L"foo-string"); +// +// x = "foo-"; +// x += ws.c_str(); // const wchar_t* null terminated +// PATH_IS(x, L"foo-wstring"); +// +// x = "foo-"; +// x += 'x'; // char +// PATH_IS(x, L"foo-x"); +// +// x = "foo-"; +// x += L'x'; // wchar +// PATH_IS(x, L"foo-x"); +// } +// +// // test_observers ------------------------------------------------------------------// +// +// void test_observers() +// { +// std::cout << "testing observers..." << std::endl; +// +// path p0("abc"); +// +// CHECK(p0.native().size() == 3); +// CHECK(p0.string() == "abc"); +// CHECK(p0.string().size() == 3); +// CHECK(p0.wstring() == L"abc"); +// CHECK(p0.wstring().size() == 3); +// +//# ifdef BOOST_WINDOWS_API +// +// path p("abc\\def/ghi"); +// +// CHECK(std::wstring(p.c_str()) == L"abc\\def/ghi"); +// +// CHECK(p.string() == "abc\\def/ghi"); +// CHECK(p.wstring() == L"abc\\def/ghi"); +// +// CHECK(p.generic_string() == "abc/def/ghi"); +// CHECK(p.generic_wstring() == L"abc/def/ghi"); +// +// CHECK(p.generic_string() == "abc/def/ghi"); +// CHECK(p.generic_string() == L"abc/def/ghi"); +// CHECK(p.generic_string() == L"abc/def/ghi"); +// +//# else // BOOST_POSIX_API +// +// path p("abc\\def/ghi"); +// +// CHECK(string(p.c_str()) == "abc\\def/ghi"); +// +// CHECK(p.string() == "abc\\def/ghi"); +// CHECK(p.wstring() == L"abc\\def/ghi"); +// +// CHECK(p.generic_string() == "abc\\def/ghi"); +// CHECK(p.generic_wstring() == L"abc\\def/ghi"); +// +// CHECK(p.generic_string() == "abc\\def/ghi"); +// CHECK(p.generic_string() == L"abc\\def/ghi"); +// CHECK(p.generic_string() == "abc\\def/ghi"); +// +//# endif +// } +// +// // test_relationals ----------------------------------------------------------------// +// +// void test_relationals() +// { +// std::cout << "testing relationals..." << std::endl; +// +// boost::hash hash; +// +//# ifdef BOOST_WINDOWS_API +// // this is a critical use case to meet user expectations +// CHECK(path("c:\\abc") == path("c:/abc")); +// CHECK(hash(path("c:\\abc")) == hash(path("c:/abc"))); +//# endif +// +// const path p("bar"); +// const path p2("baz"); +// +// CHECK(!(p < p)); +// CHECK(p < p2); +// CHECK(!(p2 < p)); +// CHECK(p < "baz"); +// CHECK(p < string("baz")); +// CHECK(p < L"baz"); +// CHECK(p < wstring(L"baz")); +// CHECK(!("baz" < p)); +// CHECK(!(string("baz") < p)); +// CHECK(!(L"baz" < p)); +// CHECK(!(wstring(L"baz") < p)); +// +// CHECK(p == p); +// CHECK(!(p == p2)); +// CHECK(!(p2 == p)); +// CHECK(p2 == "baz"); +// CHECK(p2 == string("baz")); +// CHECK(p2 == L"baz"); +// CHECK(p2 == wstring(L"baz")); +// CHECK("baz" == p2); +// CHECK(string("baz") == p2); +// CHECK(L"baz" == p2); +// CHECK(wstring(L"baz") == p2); +// +// CHECK(hash(p) == hash(p)); +// CHECK(hash(p) != hash(p2)); // Not strictly required, but desirable +// +// CHECK(!(p != p)); +// CHECK(p != p2); +// CHECK(p2 != p); +// +// CHECK(p <= p); +// CHECK(p <= p2); +// CHECK(!(p2 <= p)); +// +// CHECK(!(p > p)); +// CHECK(!(p > p2)); +// CHECK(p2 > p); +// +// CHECK(p >= p); +// CHECK(!(p >= p2)); +// CHECK(p2 >= p); +//} +// +// // test_inserter_and_extractor -----------------------------------------------------// +// +// void test_inserter_and_extractor() +// { +// std::cout << "testing inserter and extractor..." << std::endl; +// +// path p1("foo bar"); // verify space in path roundtrips per ticket #3863 +// path p2; +// +// std::stringstream ss; +// +// CHECK(p1 != p2); +// ss << p1; +// ss >> p2; +// CHECK(p1 == p2); +// +// path wp1(L"foo bar"); +// path wp2; +// +// std::wstringstream wss; +// +// CHECK(wp1 != wp2); +// wss << wp1; +// wss >> wp2; +// CHECK(wp1 == wp2); +// } +// +// // test_other_non_members ----------------------------------------------------------// +// +// void test_other_non_members() +// { +// std::cout << "testing other_non_members..." << std::endl; +// +// path p1("foo"); +// path p2("bar"); +// +// // operator / +// +// CHECK(p1 / p2 == path("foo/bar").make_preferred()); +// CHECK("foo" / p2 == path("foo/bar").make_preferred()); +// CHECK(L"foo" / p2 == path("foo/bar").make_preferred()); +// CHECK(string("foo") / p2 == path("foo/bar").make_preferred()); +// CHECK(wstring(L"foo") / p2 == path("foo/bar").make_preferred()); +// CHECK(p1 / "bar" == path("foo/bar").make_preferred()); +// CHECK(p1 / L"bar" == path("foo/bar").make_preferred()); +// CHECK(p1 / string("bar") == path("foo/bar").make_preferred()); +// CHECK(p1 / wstring(L"bar") == path("foo/bar").make_preferred()); +// +// swap(p1, p2); +// +// CHECK(p1 == "bar"); +// CHECK(p2 == "foo"); +// +// CHECK(path("").remove_filename() == ""); +// CHECK(path("foo").remove_filename() == ""); +// CHECK(path("foo/bar").remove_filename() == "foo"); +// } +// +//// // test_modifiers ------------------------------------------------------------------// +//// +//// void test_modifiers() +//// { +//// std::cout << "testing modifiers..." << std::endl; +//// +//// } +// +// // test_iterators ------------------------------------------------------------------// +// +// void test_iterators() +// { +// std::cout << "testing iterators..." << std::endl; +// +// path p1; +// CHECK(p1.begin() == p1.end()); +// +// path p2("/"); +// CHECK(p2.begin() != p2.end()); +// CHECK(*p2.begin() == "/"); +// CHECK(++p2.begin() == p2.end()); +// +// path p3("foo/bar/baz"); +// +// path::iterator it(p3.begin()); +// CHECK(p3.begin() != p3.end()); +// CHECK(*it == "foo"); +// CHECK(*++it == "bar"); +// CHECK(*++it == "baz"); +// CHECK(*--it == "bar"); +// CHECK(*--it == "foo"); +// CHECK(*++it == "bar"); +// CHECK(*++it == "baz"); +// CHECK(++it == p3.end()); +// } +// // // test_modifiers ------------------------------------------------------------------// // // void test_modifiers() @@ -587,240 +623,204 @@ namespace // std::cout << "testing modifiers..." << std::endl; // // } - - // test_iterators ------------------------------------------------------------------// - - void test_iterators() - { - std::cout << "testing iterators..." << std::endl; - - path p1; - CHECK(p1.begin() == p1.end()); - - path p2("/"); - CHECK(p2.begin() != p2.end()); - CHECK(*p2.begin() == "/"); - CHECK(++p2.begin() == p2.end()); - - path p3("foo/bar/baz"); - - path::iterator it(p3.begin()); - CHECK(p3.begin() != p3.end()); - CHECK(*it == "foo"); - CHECK(*++it == "bar"); - CHECK(*++it == "baz"); - CHECK(*--it == "bar"); - CHECK(*--it == "foo"); - CHECK(*++it == "bar"); - CHECK(*++it == "baz"); - CHECK(++it == p3.end()); - } - - // test_modifiers ------------------------------------------------------------------// - - void test_modifiers() - { - std::cout << "testing modifiers..." << std::endl; - - } - - // test_decompositions -------------------------------------------------------------// - - void test_decompositions() - { - std::cout << "testing decompositions..." << std::endl; - - CHECK(path("").root_name().string() == ""); - CHECK(path("foo").root_name().string() == ""); - CHECK(path("/").root_name().string() == ""); - CHECK(path("/foo").root_name().string() == ""); - CHECK(path("//netname").root_name().string() == "//netname"); - CHECK(path("//netname/foo").root_name().string() == "//netname"); - - CHECK(path("").root_directory().string() == ""); - CHECK(path("foo").root_directory().string() == ""); - CHECK(path("/").root_directory().string() == "/"); - CHECK(path("/foo").root_directory().string() == "/"); - CHECK(path("//netname").root_directory().string() == ""); - CHECK(path("//netname/foo").root_directory().string() == "/"); - - CHECK(path("").root_path().string() == ""); - CHECK(path("/").root_path().string() == "/"); - CHECK(path("/foo").root_path().string() == "/"); - CHECK(path("//netname").root_path().string() == "//netname"); - CHECK(path("//netname/foo").root_path().string() == "//netname/"); - -# ifdef BOOST_WINDOWS_API - CHECK(path("c:/foo").root_path().string() == "c:/"); -# endif - - CHECK(path("").relative_path().string() == ""); - CHECK(path("/").relative_path().string() == ""); - CHECK(path("/foo").relative_path().string() == "foo"); - - CHECK(path("").parent_path().string() == ""); - CHECK(path("/").parent_path().string() == ""); - CHECK(path("/foo").parent_path().string() == "/"); - CHECK(path("/foo/bar").parent_path().string() == "/foo"); - - CHECK(path("/foo/bar/baz.zoo").filename().string() == "baz.zoo"); - - CHECK(path("/foo/bar/baz.zoo").stem().string() == "baz"); - CHECK(path("/foo/bar.woo/baz").stem().string() == "baz"); - - CHECK(path("foo.bar.baz.tar.bz2").extension().string() == ".bz2"); - CHECK(path("/foo/bar/baz.zoo").extension().string() == ".zoo"); - CHECK(path("/foo/bar.woo/baz").extension().string() == ""); - } - - // test_queries --------------------------------------------------------------------// - - void test_queries() - { - std::cout << "testing queries..." << std::endl; - - path p1(""); - path p2("//netname/foo.doo"); - - CHECK(p1.empty()); - CHECK(!p1.has_root_path()); - CHECK(!p1.has_root_name()); - CHECK(!p1.has_root_directory()); - CHECK(!p1.has_relative_path()); - CHECK(!p1.has_parent_path()); - CHECK(!p1.has_filename()); - CHECK(!p1.has_stem()); - CHECK(!p1.has_extension()); - CHECK(!p1.is_absolute()); - CHECK(p1.is_relative()); - - CHECK(!p2.empty()); - CHECK(p2.has_root_path()); - CHECK(p2.has_root_name()); - CHECK(p2.has_root_directory()); - CHECK(p2.has_relative_path()); - CHECK(p2.has_parent_path()); - CHECK(p2.has_filename()); - CHECK(p2.has_stem()); - CHECK(p2.has_extension()); - CHECK(p2.is_absolute()); - CHECK(!p2.is_relative()); - - } - - // test_imbue_locale ---------------------------------------------------------------// - - void test_imbue_locale() - { - std::cout << "testing imbue locale..." << std::endl; - - // weak test case for before/after states since we don't know what characters the - // default locale accepts. - path before("abc"); - - // So that tests are run with known encoding, use Boost UTF-8 codecvt - // \u2722 and \xE2\x9C\xA2 are UTF-16 and UTF-8 FOUR TEARDROP-SPOKED ASTERISK - - std::locale global_loc = std::locale(); - std::locale loc(global_loc, new fs::detail::utf8_codecvt_facet); - std::cout << " imbuing locale ..." << std::endl; - std::locale old_loc = path::imbue(loc); - - std::cout << " testing with the imbued locale ..." << std::endl; - path p2("\xE2\x9C\xA2"); - CHECK(p2.wstring().size() == 1); - CHECK(p2.wstring()[0] == 0x2722); - - std::cout << " imbuing the original locale ..." << std::endl; - path::imbue(old_loc); - - std::cout << " testing with the original locale ..." << std::endl; - path after("abc"); - CHECK(before == after); - - std::cout << " locale testing complete" << std::endl; - } - - // test_codecvt_argument -----------------------------------------------------------// - - void test_codecvt_argument() - { - std::cout << "testing codecvt arguments..." << std::endl; - - const char * c1 = "a1"; - const std::string s1(c1); - const std::wstring ws1(L"b2"); // off-by-one mimics test_codecvt - const std::string s2("y8"); - const std::wstring ws2(L"z9"); - - test_codecvt cvt; // produces off-by-one values that will always differ from - // the system's default locale codecvt facet - - int t = 0; - - // constructors - std::cout << " constructors test " << ++t << std::endl; - path p(c1, cvt); - NATIVE_IS(p, s1, ws1); - - std::cout << " test " << ++t << std::endl; - path p1(s1.begin(), s1.end(), cvt); - NATIVE_IS(p1, s1, ws1); - - std::cout << " test " << ++t << std::endl; - path p2(ws2, cvt); - NATIVE_IS(p2, s2, ws2); - - std::cout << " test " << ++t << std::endl; - path p3(ws2.begin(), ws2.end(), cvt); - NATIVE_IS(p3, s2, ws2); - - // path p2(p1, cvt); // fails to compile, and that is OK - - // assigns - p1.clear(); - std::cout << " assigns test " << ++t << std::endl; - p1.assign(s1,cvt); - NATIVE_IS(p1, s1, ws1); - p1.clear(); - std::cout << " test " << ++t << std::endl; - p1.assign(s1.begin(), s1.end(), cvt); - NATIVE_IS(p1, s1, ws1); - // p1.assign(p, cvt); // fails to compile, and that is OK - - // appends - p1.clear(); - std::cout << " appends test " << ++t << std::endl; - p1.append(s1,cvt); - NATIVE_IS(p1, s1, ws1); - p1.clear(); - std::cout << " test " << ++t << std::endl; - p1.append(s1.begin(), s1.end(), cvt); - NATIVE_IS(p1, s1, ws1); - // p1.append(p, cvt); // fails to compile, and that is OK - - // native observers - std::cout << " native observers test " << ++t << std::endl; - CHECK(p.string(cvt) == s1); - std::cout << " test " << ++t << std::endl; - CHECK(p.string(cvt) == s1); - std::cout << " test " << ++t << std::endl; - CHECK(p.string(cvt) == ws1); - std::cout << " test " << ++t << std::endl; - CHECK(p.wstring(cvt) == ws1); - - // generic observers - std::cout << " generic observers test " << ++t << std::endl; - CHECK(p.generic_string(cvt) == s1); - std::cout << " test " << ++t << std::endl; - CHECK(p.generic_string(cvt) == s1); - std::cout << " test " << ++t << std::endl; - CHECK(p.generic_string(cvt) == ws1); - std::cout << " test " << ++t << std::endl; - CHECK(p.generic_wstring(cvt) == ws1); - - std::cout << " codecvt arguments testing complete" << std::endl; - } +// +// // test_decompositions -------------------------------------------------------------// +// +// void test_decompositions() +// { +// std::cout << "testing decompositions..." << std::endl; +// +// CHECK(path("").root_name().string() == ""); +// CHECK(path("foo").root_name().string() == ""); +// CHECK(path("/").root_name().string() == ""); +// CHECK(path("/foo").root_name().string() == ""); +// CHECK(path("//netname").root_name().string() == "//netname"); +// CHECK(path("//netname/foo").root_name().string() == "//netname"); +// +// CHECK(path("").root_directory().string() == ""); +// CHECK(path("foo").root_directory().string() == ""); +// CHECK(path("/").root_directory().string() == "/"); +// CHECK(path("/foo").root_directory().string() == "/"); +// CHECK(path("//netname").root_directory().string() == ""); +// CHECK(path("//netname/foo").root_directory().string() == "/"); +// +// CHECK(path("").root_path().string() == ""); +// CHECK(path("/").root_path().string() == "/"); +// CHECK(path("/foo").root_path().string() == "/"); +// CHECK(path("//netname").root_path().string() == "//netname"); +// CHECK(path("//netname/foo").root_path().string() == "//netname/"); +// +//# ifdef BOOST_WINDOWS_API +// CHECK(path("c:/foo").root_path().string() == "c:/"); +//# endif +// +// CHECK(path("").relative_path().string() == ""); +// CHECK(path("/").relative_path().string() == ""); +// CHECK(path("/foo").relative_path().string() == "foo"); +// +// CHECK(path("").parent_path().string() == ""); +// CHECK(path("/").parent_path().string() == ""); +// CHECK(path("/foo").parent_path().string() == "/"); +// CHECK(path("/foo/bar").parent_path().string() == "/foo"); +// +// CHECK(path("/foo/bar/baz.zoo").filename().string() == "baz.zoo"); +// +// CHECK(path("/foo/bar/baz.zoo").stem().string() == "baz"); +// CHECK(path("/foo/bar.woo/baz").stem().string() == "baz"); +// +// CHECK(path("foo.bar.baz.tar.bz2").extension().string() == ".bz2"); +// CHECK(path("/foo/bar/baz.zoo").extension().string() == ".zoo"); +// CHECK(path("/foo/bar.woo/baz").extension().string() == ""); +// } +// +// // test_queries --------------------------------------------------------------------// +// +// void test_queries() +// { +// std::cout << "testing queries..." << std::endl; +// +// path p1(""); +// path p2("//netname/foo.doo"); +// +// CHECK(p1.empty()); +// CHECK(!p1.has_root_path()); +// CHECK(!p1.has_root_name()); +// CHECK(!p1.has_root_directory()); +// CHECK(!p1.has_relative_path()); +// CHECK(!p1.has_parent_path()); +// CHECK(!p1.has_filename()); +// CHECK(!p1.has_stem()); +// CHECK(!p1.has_extension()); +// CHECK(!p1.is_absolute()); +// CHECK(p1.is_relative()); +// +// CHECK(!p2.empty()); +// CHECK(p2.has_root_path()); +// CHECK(p2.has_root_name()); +// CHECK(p2.has_root_directory()); +// CHECK(p2.has_relative_path()); +// CHECK(p2.has_parent_path()); +// CHECK(p2.has_filename()); +// CHECK(p2.has_stem()); +// CHECK(p2.has_extension()); +// CHECK(p2.is_absolute()); +// CHECK(!p2.is_relative()); +// +// } +// +// // test_imbue_locale ---------------------------------------------------------------// +// +// void test_imbue_locale() +// { +// std::cout << "testing imbue locale..." << std::endl; +// +// // weak test case for before/after states since we don't know what characters the +// // default locale accepts. +// path before("abc"); +// +// // So that tests are run with known encoding, use Boost UTF-8 codecvt +// // \u2722 and \xE2\x9C\xA2 are UTF-16 and UTF-8 FOUR TEARDROP-SPOKED ASTERISK +// +// std::locale global_loc = std::locale(); +// std::locale loc(global_loc, new fs::detail::utf8_codecvt_facet); +// std::cout << " imbuing locale ..." << std::endl; +// std::locale old_loc = path::imbue(loc); +// +// std::cout << " testing with the imbued locale ..." << std::endl; +// path p2("\xE2\x9C\xA2"); +// CHECK(p2.wstring().size() == 1); +// CHECK(p2.wstring()[0] == 0x2722); +// +// std::cout << " imbuing the original locale ..." << std::endl; +// path::imbue(old_loc); +// +// std::cout << " testing with the original locale ..." << std::endl; +// path after("abc"); +// CHECK(before == after); +// +// std::cout << " locale testing complete" << std::endl; +// } +// +// // test_codecvt_argument -----------------------------------------------------------// +// +// void test_codecvt_argument() +// { +// std::cout << "testing codecvt arguments..." << std::endl; +// +// const char * c1 = "a1"; +// const std::string s1(c1); +// const std::wstring ws1(L"b2"); // off-by-one mimics test_codecvt +// const std::string s2("y8"); +// const std::wstring ws2(L"z9"); +// +// test_codecvt cvt; // produces off-by-one values that will always differ from +// // the system's default locale codecvt facet +// +// int t = 0; +// +// // constructors +// std::cout << " constructors test " << ++t << std::endl; +// path p(c1, cvt); +// NATIVE_IS(p, s1, ws1); +// +// std::cout << " test " << ++t << std::endl; +// path p1(s1.begin(), s1.end(), cvt); +// NATIVE_IS(p1, s1, ws1); +// +// std::cout << " test " << ++t << std::endl; +// path p2(ws2, cvt); +// NATIVE_IS(p2, s2, ws2); +// +// std::cout << " test " << ++t << std::endl; +// path p3(ws2.begin(), ws2.end(), cvt); +// NATIVE_IS(p3, s2, ws2); +// +// // path p2(p1, cvt); // fails to compile, and that is OK +// +// // assigns +// p1.clear(); +// std::cout << " assigns test " << ++t << std::endl; +// p1.assign(s1,cvt); +// NATIVE_IS(p1, s1, ws1); +// p1.clear(); +// std::cout << " test " << ++t << std::endl; +// p1.assign(s1.begin(), s1.end(), cvt); +// NATIVE_IS(p1, s1, ws1); +// // p1.assign(p, cvt); // fails to compile, and that is OK +// +// // appends +// p1.clear(); +// std::cout << " appends test " << ++t << std::endl; +// p1.append(s1,cvt); +// NATIVE_IS(p1, s1, ws1); +// p1.clear(); +// std::cout << " test " << ++t << std::endl; +// p1.append(s1.begin(), s1.end(), cvt); +// NATIVE_IS(p1, s1, ws1); +// // p1.append(p, cvt); // fails to compile, and that is OK +// +// // native observers +// std::cout << " native observers test " << ++t << std::endl; +// CHECK(p.string(cvt) == s1); +// std::cout << " test " << ++t << std::endl; +// CHECK(p.string(cvt) == s1); +// std::cout << " test " << ++t << std::endl; +// CHECK(p.string(cvt) == ws1); +// std::cout << " test " << ++t << std::endl; +// CHECK(p.wstring(cvt) == ws1); +// +// // generic observers +// std::cout << " generic observers test " << ++t << std::endl; +// CHECK(p.generic_string(cvt) == s1); +// std::cout << " test " << ++t << std::endl; +// CHECK(p.generic_string(cvt) == s1); +// std::cout << " test " << ++t << std::endl; +// CHECK(p.generic_string(cvt) == ws1); +// std::cout << " test " << ++t << std::endl; +// CHECK(p.generic_wstring(cvt) == ws1); +// +// std::cout << " codecvt arguments testing complete" << std::endl; +// } // test_overloads ------------------------------------------------------------------// @@ -842,112 +842,112 @@ namespace path wp4(L"foo"); } - // test_error_handling -------------------------------------------------------------// - - class error_codecvt - : public std::codecvt< wchar_t, char, std::mbstate_t > - { - public: - explicit error_codecvt() - : std::codecvt() {} - protected: - - virtual bool do_always_noconv() const throw() { return false; } - virtual int do_encoding() const throw() { return 0; } - - virtual std::codecvt_base::result do_in(std::mbstate_t&, - const char*, const char*, const char*&, - wchar_t*, wchar_t*, wchar_t*&) const - { - static std::codecvt_base::result r = std::codecvt_base::noconv; - if (r == std::codecvt_base::partial) r = std::codecvt_base::error; - else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv; - else r = std::codecvt_base::partial; - return r; - } - - virtual std::codecvt_base::result do_out(std::mbstate_t &, - const wchar_t*, const wchar_t*, const wchar_t*&, - char*, char*, char*&) const - { - static std::codecvt_base::result r = std::codecvt_base::noconv; - if (r == std::codecvt_base::partial) r = std::codecvt_base::error; - else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv; - else r = std::codecvt_base::partial; - return r; - } - - virtual std::codecvt_base::result do_unshift(std::mbstate_t&, - char*, char*, char* &) const { return ok; } - virtual int do_length(std::mbstate_t &, - const char*, const char*, std::size_t) const { return 0; } - virtual int do_max_length() const throw () { return 0; } - }; - - void test_error_handling() - { - std::cout << "testing error handling..." << std::endl; - - std::locale global_loc = std::locale(); - std::locale loc(global_loc, new error_codecvt); - std::cout << " imbuing error locale ..." << std::endl; - std::locale old_loc = path::imbue(loc); - - // These tests rely on a path constructor that fails in the locale conversion. - // Thus construction has to call codecvt. Force that by using a narrow string - // for Windows, and a wide string for POSIX. -# ifdef BOOST_WINDOWS_API -# define STRING_FOO_ "foo" -# else -# define STRING_FOO_ L"foo" -# endif - - { - std::cout << " testing std::codecvt_base::partial error..." << std::endl; - bool exception_thrown (false); - try { path(STRING_FOO_); } - catch (const bs::system_error & ex) - { - exception_thrown = true; - BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::partial, - fs::codecvt_error_category())); - } - catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } - BOOST_TEST(exception_thrown); - } - - { - std::cout << " testing std::codecvt_base::error error..." << std::endl; - bool exception_thrown (false); - try { path(STRING_FOO_); } - catch (const bs::system_error & ex) - { - exception_thrown = true; - BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::error, - fs::codecvt_error_category())); - } - catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } - BOOST_TEST(exception_thrown); - } - - { - std::cout << " testing std::codecvt_base::noconv error..." << std::endl; - bool exception_thrown (false); - try { path(STRING_FOO_); } - catch (const bs::system_error & ex) - { - exception_thrown = true; - BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::noconv, - fs::codecvt_error_category())); - } - catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } - BOOST_TEST(exception_thrown); - } - - std::cout << " restoring original locale ..." << std::endl; - path::imbue(old_loc); - std::cout << " testing error handling complete" << std::endl; - } +// // test_error_handling -------------------------------------------------------------// +// +// class error_codecvt +// : public std::codecvt< wchar_t, char, std::mbstate_t > +// { +// public: +// explicit error_codecvt() +// : std::codecvt() {} +// protected: +// +// virtual bool do_always_noconv() const throw() { return false; } +// virtual int do_encoding() const throw() { return 0; } +// +// virtual std::codecvt_base::result do_in(std::mbstate_t&, +// const char*, const char*, const char*&, +// wchar_t*, wchar_t*, wchar_t*&) const +// { +// static std::codecvt_base::result r = std::codecvt_base::noconv; +// if (r == std::codecvt_base::partial) r = std::codecvt_base::error; +// else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv; +// else r = std::codecvt_base::partial; +// return r; +// } +// +// virtual std::codecvt_base::result do_out(std::mbstate_t &, +// const wchar_t*, const wchar_t*, const wchar_t*&, +// char*, char*, char*&) const +// { +// static std::codecvt_base::result r = std::codecvt_base::noconv; +// if (r == std::codecvt_base::partial) r = std::codecvt_base::error; +// else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv; +// else r = std::codecvt_base::partial; +// return r; +// } +// +// virtual std::codecvt_base::result do_unshift(std::mbstate_t&, +// char*, char*, char* &) const { return ok; } +// virtual int do_length(std::mbstate_t &, +// const char*, const char*, std::size_t) const { return 0; } +// virtual int do_max_length() const throw () { return 0; } +// }; +// +// void test_error_handling() +// { +// std::cout << "testing error handling..." << std::endl; +// +// std::locale global_loc = std::locale(); +// std::locale loc(global_loc, new error_codecvt); +// std::cout << " imbuing error locale ..." << std::endl; +// std::locale old_loc = path::imbue(loc); +// +// // These tests rely on a path constructor that fails in the locale conversion. +// // Thus construction has to call codecvt. Force that by using a narrow string +// // for Windows, and a wide string for POSIX. +//# ifdef BOOST_WINDOWS_API +//# define STRING_FOO_ "foo" +//# else +//# define STRING_FOO_ L"foo" +//# endif +// +// { +// std::cout << " testing std::codecvt_base::partial error..." << std::endl; +// bool exception_thrown (false); +// try { path(STRING_FOO_); } +// catch (const bs::system_error & ex) +// { +// exception_thrown = true; +// BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::partial, +// fs::codecvt_error_category())); +// } +// catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } +// BOOST_TEST(exception_thrown); +// } +// +// { +// std::cout << " testing std::codecvt_base::error error..." << std::endl; +// bool exception_thrown (false); +// try { path(STRING_FOO_); } +// catch (const bs::system_error & ex) +// { +// exception_thrown = true; +// BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::error, +// fs::codecvt_error_category())); +// } +// catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } +// BOOST_TEST(exception_thrown); +// } +// +// { +// std::cout << " testing std::codecvt_base::noconv error..." << std::endl; +// bool exception_thrown (false); +// try { path(STRING_FOO_); } +// catch (const bs::system_error & ex) +// { +// exception_thrown = true; +// BOOST_TEST_EQ(ex.code(), bs::error_code(std::codecvt_base::noconv, +// fs::codecvt_error_category())); +// } +// catch (...) { std::cout << "***** unexpected exception type *****" << std::endl; } +// BOOST_TEST(exception_thrown); +// } +// +// std::cout << " restoring original locale ..." << std::endl; +// path::imbue(old_loc); +// std::cout << " testing error handling complete" << std::endl; +// } # if 0 @@ -1076,20 +1076,20 @@ int cpp_main(int, char*[]) test_overloads(); test_constructors(); - test_assignments(); - test_appends(); - test_concats(); - test_modifiers(); - test_observers(); - test_relationals(); - test_inserter_and_extractor(); - test_other_non_members(); - test_iterators(); - test_decompositions(); - test_queries(); - test_imbue_locale(); - test_codecvt_argument(); - test_error_handling(); + //test_assignments(); + //test_appends(); + //test_concats(); + //test_modifiers(); + //test_observers(); + //test_relationals(); + //test_inserter_and_extractor(); + //test_other_non_members(); + //test_iterators(); + //test_decompositions(); + //test_queries(); + //test_imbue_locale(); + //test_codecvt_argument(); + //test_error_handling(); #if 0