X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ftests_filesystem%2Ftest_directory_tree.cpp;h=5e9fe6b3426c93d754c8695d115f915745f6bc6f;hb=154c324a33c8566c9f10dae55f6cadaf30862338;hp=756138ca52ce1900ac49bbf3b595dc0eb8a925bb;hpb=51d71c226be424b6a698c7474d237e8c69661af5;p=feisty_meow.git diff --git a/nucleus/library/tests_filesystem/test_directory_tree.cpp b/nucleus/library/tests_filesystem/test_directory_tree.cpp index 756138ca..5e9fe6b3 100644 --- a/nucleus/library/tests_filesystem/test_directory_tree.cpp +++ b/nucleus/library/tests_filesystem/test_directory_tree.cpp @@ -12,16 +12,17 @@ * Please send any updates to: fred@gruntose.com * */ +#include #include #include -#include -#include -#include -#include #include #include #include +#include +#include +#include #include +#include #include #include @@ -30,6 +31,7 @@ using namespace basis; using namespace mathematics; using namespace filesystem; using namespace loggers; +using namespace processes; using namespace structures; using namespace textual; using namespace timely; @@ -190,6 +192,36 @@ LOG(diffs.text_form()); ASSERT_FALSE(diffs.elements(), "no differences for reverse compare identical dirs"); } + { + // sixth test: see if the make_directories function works. +LOG("reading tree to recreate"); + directory_tree dir(path, pattern.s()); + ASSERT_TRUE(dir.good(), "makedirs test directory reading"); + filename tmpdir(environment::get("FEISTY_MEOW_GENERATED_STORE") + "/zz_balfazzaral"); + LOG(astring("will write to tmp in ") + tmpdir); + basis::outcome result = dir.make_directories(tmpdir.raw()); + ASSERT_EQUAL(result.value(), common::OKAY, "makedirs should succeed"); + + +LOG("what happened with that? did it work?"); + +//hmmm: compare the directories with what we expect to be made; +// do a dirtree iterator on the path, and make sure each of those exists in the target place. + + + // clean up the output directory. +//this won't do it; it's a directory! +// bool worked = tmpdir.recursive_unlink(); +// ASSERT_TRUE(worked, "removing temporary files after test"); + +//hmmm: plug in real recursive delete here instead. +basis::un_int kid; +launch_process::run("/bin/rm", astring("-rf ") + tmpdir.raw(), launch_process::AWAIT_APP_EXIT, kid); +ASSERT_FALSE(kid, "removing temporary files after test"); + + } + + // nth test: // combine the results of the second test with a comparison like in the // third test. delete all of those temporary files that were added.