From 89c121cf45e5ccf5b35aa39b8bcbf0bc680d08aa Mon Sep 17 00:00:00 2001 From: Beman Dawes Date: Tue, 13 Aug 2002 15:49:09 +0000 Subject: [PATCH] Add test to detect premature close of Handle [SVN r380] --- test/operations_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/operations_test.cpp b/test/operations_test.cpp index 4f880f3..9b264ff 100644 --- a/test/operations_test.cpp +++ b/test/operations_test.cpp @@ -120,6 +120,14 @@ int test_main( int, char * [] ) BOOST_TEST( !fs::is_directory( file_ph ) ); verify_file( file_ph, "foobar1" ); + // there was an inital bug in directory_iterator that caused premature + // close of an OS handle. The next five lines will detect regression. + { + fs::directory_iterator di; + { di = fs::directory_iterator( dir ); } + BOOST_TEST( ++di != fs::directory_iterator() ); + } + // copy_file() tests fs::copy_file( file_ph, d1 << "f2" ); BOOST_TEST( fs::exists( file_ph ) );