MCPcopy Create free account
hub / github.com/boostorg/filesystem / directory_iterator_tests

Function directory_iterator_tests

test/operations_test.cpp:500–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498// directory_iterator_tests --------------------------------------------------------//
499
500void directory_iterator_tests()
501{
502 cout << "directory_iterator_tests..." << endl;
503
504 bool dir_itr_exception(false);
505 try
506 {
507 fs::directory_iterator it("");
508 }
509 catch (const fs::filesystem_error&)
510 {
511 dir_itr_exception = true;
512 }
513 BOOST_TEST(dir_itr_exception);
514
515 error_code ec;
516
517 BOOST_TEST(!ec);
518 fs::directory_iterator it("", ec);
519 BOOST_TEST(ec);
520
521 dir_itr_exception = false;
522 try
523 {
524 fs::directory_iterator itx("nosuchdirectory");
525 }
526 catch (const fs::filesystem_error&)
527 {
528 dir_itr_exception = true;
529 }
530 BOOST_TEST(dir_itr_exception);
531
532 ec.clear();
533 fs::directory_iterator it2x("nosuchdirectory", ec);
534 BOOST_TEST(ec);
535
536 dir_itr_exception = false;
537 try
538 {
539 error_code ecx;
540 fs::directory_iterator itx("nosuchdirectory", ecx);
541 BOOST_TEST(ecx);
542 BOOST_TEST(ecx == boost::system::errc::no_such_file_or_directory);
543 }
544 catch (const fs::filesystem_error&)
545 {
546 dir_itr_exception = true;
547 }
548 BOOST_TEST(!dir_itr_exception);
549
550 // create a second directory named d2
551 d2 = dir / "d2";
552 fs::create_directory(d2);
553 BOOST_TEST(fs::exists(d2));
554 BOOST_TEST(fs::is_directory(d2));
555
556 // test the basic operation of directory_iterators, and test that
557 // stepping one iterator doesn't affect a different iterator.

Callers 1

cpp_mainFunction · 0.85

Calls 15

directory_iteratorClass · 0.85
stringFunction · 0.85
clearMethod · 0.80
statusMethod · 0.80
stringMethod · 0.80
filenameMethod · 0.80
pathMethod · 0.80
symlink_statusMethod · 0.80
root_nameMethod · 0.80
parent_pathMethod · 0.80
create_fileFunction · 0.70
create_directoryFunction · 0.50

Tested by

no test coverage detected