|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r50857 - in sandbox/filesystem-v3: boost/filesystem libs/filesystem/src libs/filesystem/test libs/filesystem/test/msvc/operations_test
From: bdawes_at_[hidden]
Date: 2009-01-28 13:07:55
Author: bemandawes
Date: 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
New Revision: 50857
URL: http://svn.boost.org/trac/boost/changeset/50857
Log:
filesystem.v3: remove path inserter, extractor templates. change copy_any name back to copy.
Text files modified:
sandbox/filesystem-v3/boost/filesystem/operations.hpp | 3 +--
sandbox/filesystem-v3/boost/filesystem/path.hpp | 23 +----------------------
sandbox/filesystem-v3/libs/filesystem/src/operations.cpp | 2 +-
sandbox/filesystem-v3/libs/filesystem/test/msvc/operations_test/operations_test.vcproj | 4 ++--
sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp | 15 ++++++++++-----
sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp | 22 +++++++++++-----------
sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp | 26 +++++++++++++++++++++++++-
7 files changed, 51 insertions(+), 44 deletions(-)
Modified: sandbox/filesystem-v3/boost/filesystem/operations.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/operations.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/operations.hpp 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
@@ -186,8 +186,7 @@
path complete( const path & p, const path & base = initial_path() );
BOOST_FILESYSTEM_DECL
- void copy_any( const path & from, const path & to,
- system::error_code & ec = throws() );
+ void copy( const path & from, const path & to, system::error_code & ec = throws() );
BOOST_FILESYSTEM_DECL
void copy_directory( const path & from, const path & to,
Modified: sandbox/filesystem-v3/boost/filesystem/path.hpp
==============================================================================
--- sandbox/filesystem-v3/boost/filesystem/path.hpp (original)
+++ sandbox/filesystem-v3/boost/filesystem/path.hpp 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
@@ -17,7 +17,6 @@
TO DO
* Windows, POSIX, conversions for char16_t, char32_t for supporting compilers.
- * Fix inserter/extractor problems; see comments in commented out code below.
* Need an error category for codecvt errors. Seed path.cpp detail::append, etc.
* Add Alternate Data Stream test cases. See http://en.wikipedia.org/wiki/NTFS Features.
* test case: relational on paths differing only in trailing separator. rationale?
@@ -775,27 +774,6 @@
// inserters and extractors
- // templated versions are too aggressive; path_test gets ambiguous overloads
- // with std::basic_string.
- //
- //template < class Ostream >
- //Ostream & operator<<( Ostream & os, const path & p )
- //{
- // os << p.string< std::basic_string<typename Ostream::char_type,
- // typename Ostream::traits_type > >();
- // return os;
- //}
- //
- //template < class Istream >
- //Istream & operator>>( Istream & is, path & p )
- //{
- // std::basic_string<typename Istream::char_type,
- // typename Istream::traits_type > > str;
- // is >> str;
- // p = str;
- // return is;
- //}
-
inline std::ostream & operator<<( std::ostream & os, const path & p )
{
os << p.string();
@@ -823,6 +801,7 @@
p = str;
return is;
}
+
// name_checks
BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name );
Modified: sandbox/filesystem-v3/libs/filesystem/src/operations.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/src/operations.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/src/operations.cpp 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
@@ -544,7 +544,7 @@
}
BOOST_FILESYSTEM_DECL
- void copy_any( const path & from, const path & to, system::error_code & ec )
+ void copy( const path & from, const path & to, system::error_code & ec )
{
file_status s( symlink_status( from, ec ) );
if ( &ec != &throws() && ec ) return;
Modified: sandbox/filesystem-v3/libs/filesystem/test/msvc/operations_test/operations_test.vcproj
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/msvc/operations_test/operations_test.vcproj (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/msvc/operations_test/operations_test.vcproj 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
@@ -85,7 +85,7 @@
<Tool
Name="VCPostBuildEventTool"
Description="Executing test $(TargetName).exe..."
- CommandLine=""$(TargetDir)\$(TargetName).exe""
+ CommandLine=""$(TargetDir)\$(TargetName).exe" -x"
/>
</Configuration>
<Configuration
@@ -159,7 +159,7 @@
<Tool
Name="VCPostBuildEventTool"
Description="Executing test $(TargetName).exe..."
- CommandLine=""$(TargetDir)\$(TargetName).exe""
+ CommandLine=""$(TargetDir)\$(TargetName).exe" -x"
/>
</Configuration>
</Configurations>
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_test.cpp 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
@@ -57,6 +57,7 @@
typedef int errno_t;
std::string platform( BOOST_PLATFORM );
bool report_throws;
+ bool cleanup = true;
fs::directory_iterator end_itr;
fs::path dir;
fs::path d1;
@@ -741,6 +742,7 @@
int test_main( int argc, char * argv[] )
{
if ( argc > 1 && *argv[1]=='-' && *(argv[1]+1)=='t' ) report_throws = true;
+ if ( argc > 1 && *argv[1]=='-' && *(argv[1]+1)=='x' ) cleanup = false;
// The choice of platform is make at runtime rather than compile-time
// so that compile errors for all platforms will be detected even though
@@ -1072,11 +1074,14 @@
BOOST_CHECK( time_diff >= -60.0 && time_diff <= 60.0 );
// post-test cleanup
- BOOST_CHECK( fs::remove_all( dir ) != 0 );
- // above was added just to simplify testing, but it ended up detecting
- // a bug (failure to close an internal search handle).
- BOOST_CHECK( !fs::exists( dir ) );
- BOOST_CHECK( fs::remove_all( dir ) == 0 );
+ if ( cleanup )
+ {
+ BOOST_CHECK( fs::remove_all( dir ) != 0 );
+ // above was added just to simplify testing, but it ended up detecting
+ // a bug (failure to close an internal search handle).
+ BOOST_CHECK( !fs::exists( dir ) );
+ BOOST_CHECK( fs::remove_all( dir ) == 0 );
+ }
return 0;
} // main
Modified: sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/operations_unit_test.cpp 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
@@ -55,17 +55,6 @@
CHECK( is_regular_file( this_file ) );
CHECK( !is_empty( this_file ) );
CHECK( !is_other( this_file ) );
-
- space_info info = space( "/" );
-
- CHECK( info.available <= info.capacity );
-
-// CHECK( equivalent( "/", "/" ) );
-// CHECK( !equivalent( "/", "." ) );
-
- std::time_t ft = last_write_time( "." );
-
- last_write_time( ".", std::time_t(-1), ec );
}
// directory_iterator_test -----------------------------------------------//
@@ -123,6 +112,17 @@
CHECK( !boost::filesystem::remove( "no-such-file-or-directory" ) );
CHECK( !remove_all( "no-such-file-or-directory" ) );
+ space_info info = space( "/" );
+
+ CHECK( info.available <= info.capacity );
+
+ CHECK( equivalent( "/", "/" ) );
+ CHECK( !equivalent( "/", "." ) );
+
+ std::time_t ft = last_write_time( "." );
+
+ last_write_time( ".", std::time_t(-1), ec );
+
}
} // unnamed namespace
Modified: sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp
==============================================================================
--- sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp (original)
+++ sandbox/filesystem-v3/libs/filesystem/test/path_unit_test.cpp 2009-01-28 13:07:54 EST (Wed, 28 Jan 2009)
@@ -23,6 +23,7 @@
#include "../src/utf8_codecvt_facet.hpp" // for imbue tests
#include <iostream>
+#include <sstream>
#include <string>
namespace fs = boost::filesystem;
@@ -306,6 +307,23 @@
CHECK( p2 >= p );
}
+ // test_inserter_and_extractor -----------------------------------------------------//
+
+ void test_inserter_and_extractor()
+ {
+ std::cout << "testing inserter and extractor..." << std::endl;
+
+ path p1("foo");
+ path p2;
+
+ std::stringstream ss;
+
+ CHECK( p1 != p2 );
+ ss << p1;
+ ss >> p2;
+ CHECK( p1 == p2 );
+ }
+
// test_other_non_members ----------------------------------------------------------//
void test_other_non_members()
@@ -328,7 +346,6 @@
CHECK( p1 / wstring( L"bar" ) == path( "foo/bar" ).native() );
swap( p1, p2 );
- // swap
CHECK( p1 == "bar" );
CHECK( p2 == "foo" );
@@ -596,6 +613,7 @@
test_observers();
////test_appends();
test_relationals();
+ test_inserter_and_extractor();
test_other_non_members();
//test_modifiers();
test_iterators();
@@ -604,6 +622,12 @@
test_imbue_locale();
//test_convert_with_locale();
test_user_supplied_type();
+
+ std::string foo("\\abc");
+ const char * bar = "/abc";
+
+ if ( foo == bar )
+ cout << "unintended consequence\n";
cout << errors << " errors detected\n";
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk