Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49498 - in branches/release: boost/filesystem libs/filesystem/test
From: bdawes_at_[hidden]
Date: 2008-10-30 21:13:32


Author: bemandawes
Date: 2008-10-30 21:13:31 EDT (Thu, 30 Oct 2008)
New Revision: 49498
URL: http://svn.boost.org/trac/boost/changeset/49498

Log:
Filesystem: merge recent and missed changes from trunk
Text files modified:
   branches/release/boost/filesystem/path.hpp | 2
   branches/release/libs/filesystem/test/operations_test.cpp | 63 +++++++++++++++++++++++++++------------
   2 files changed, 45 insertions(+), 20 deletions(-)

Modified: branches/release/boost/filesystem/path.hpp
==============================================================================
--- branches/release/boost/filesystem/path.hpp (original)
+++ branches/release/boost/filesystem/path.hpp 2008-10-30 21:13:31 EDT (Thu, 30 Oct 2008)
@@ -203,7 +203,7 @@
       }
 
       basic_path & remove_filename();
- basic_path & replace_extension( const string_type & new_extension = "" );
+ basic_path & replace_extension( const string_type & new_extension = string_type() );
 
 # ifndef BOOST_FILESYSTEM_NO_DEPRECATED
       basic_path & remove_leaf() { return remove_filename(); }

Modified: branches/release/libs/filesystem/test/operations_test.cpp
==============================================================================
--- branches/release/libs/filesystem/test/operations_test.cpp (original)
+++ branches/release/libs/filesystem/test/operations_test.cpp 2008-10-30 21:13:31 EDT (Thu, 30 Oct 2008)
@@ -304,6 +304,7 @@
       == "//net/bar/foo" );
 
   // predicate and status tests
+ BOOST_CHECK( fs::exists( "/" ) );
   fs::path ng( " no-way, Jose" );
   BOOST_CHECK( !fs::exists( ng ) );
   BOOST_CHECK( !fs::is_directory( ng ) );
@@ -325,6 +326,49 @@
   BOOST_CHECK( !fs::is_symlink( stat ) );
 
   fs::path dir( fs::initial_path<fs::path>() / temp_dir_name );
+
+ if ( fs::exists( dir ) )
+ fs::remove_all( dir ); // remove residue from prior failed tests
+ BOOST_CHECK( !fs::exists( dir ) );
+
+ // create a directory, then check it for consistency
+ // take extra care to report problems, since if this fails
+ // many subsequent tests will fail
+ try
+ {
+ fs::create_directory( dir );
+ }
+
+ catch ( const fs::filesystem_error & x )
+ {
+ std::cout << x.what() << "\n\n"
+ "***** Creating directory " << dir.string() << " failed. *****\n"
+ "***** This is a serious error that will prevent further tests *****\n"
+ "***** from returning useful results. Further testing is aborted. *****\n\n";
+ return 1;
+ }
+
+ catch ( ... )
+ {
+ std::cout << "\n\n"
+ "***** Creating directory " << dir.string() << " failed. *****\n"
+ "***** This is a serious error that will prevent further tests *****\n"
+ "***** from returning useful results. Further testing is aborted. *****\n\n";
+ return 1;
+ }
+
+ BOOST_CHECK( fs::exists( dir ) );
+ BOOST_CHECK( BOOST_FS_IS_EMPTY( dir ) );
+ BOOST_CHECK( fs::is_directory( dir ) );
+ BOOST_CHECK( !fs::is_regular_file( dir ) );
+ BOOST_CHECK( !fs::is_other( dir ) );
+ BOOST_CHECK( !fs::is_symlink( dir ) );
+ stat = fs::status( dir );
+ BOOST_CHECK( fs::exists( stat ) );
+ BOOST_CHECK( fs::is_directory( stat ) );
+ BOOST_CHECK( !fs::is_regular_file( stat ) );
+ BOOST_CHECK( !fs::is_other( stat ) );
+ BOOST_CHECK( !fs::is_symlink( stat ) );
   
   // Windows only tests
   if ( platform == "Windows" )
@@ -371,9 +415,6 @@
       == fs::initial_path<fs::path>().root_path().string()+"foo" );
   } // POSIX
 
- fs::remove_all( dir ); // in case residue from prior failed tests
- BOOST_CHECK( !fs::exists( dir ) );
-
   // the bound functions should throw, so CHECK_EXCEPTION() should return true
   BOOST_CHECK( CHECK_EXCEPTION( bad_file_size, ENOENT ) );
 
@@ -388,22 +429,6 @@
   std::cout << "sizeof(boost::uintmax_t) = " << sizeof(boost::uintmax_t) << '\n';
   BOOST_CHECK( sizeof( boost::uintmax_t ) >= 8 );
 
- // create a directory, then check it for consistency
- BOOST_CHECK( fs::create_directory( dir ) );
-
- BOOST_CHECK( fs::exists( dir ) );
- BOOST_CHECK( BOOST_FS_IS_EMPTY( dir ) );
- BOOST_CHECK( fs::is_directory( dir ) );
- BOOST_CHECK( !fs::is_regular_file( dir ) );
- BOOST_CHECK( !fs::is_other( dir ) );
- BOOST_CHECK( !fs::is_symlink( dir ) );
- stat = fs::status( dir );
- BOOST_CHECK( fs::exists( stat ) );
- BOOST_CHECK( fs::is_directory( stat ) );
- BOOST_CHECK( !fs::is_regular_file( stat ) );
- BOOST_CHECK( !fs::is_other( stat ) );
- BOOST_CHECK( !fs::is_symlink( stat ) );
-
   // set the current directory, then check it for consistency
   fs::path original_dir = fs::current_path<fs::path>();
   BOOST_CHECK( dir != original_dir );


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