From e06127965490880dcb5e996fa8a3a7d92b169e50 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Mon, 2 Sep 2024 13:40:17 +0200 Subject: [PATCH] Removing any useless file after all tests --- Unit testing/billy_objects_tests.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Unit testing/billy_objects_tests.cpp b/Unit testing/billy_objects_tests.cpp index c19d918..77e24df 100644 --- a/Unit testing/billy_objects_tests.cpp +++ b/Unit testing/billy_objects_tests.cpp @@ -152,3 +152,15 @@ TEST_CASE("[D] Printing Billy's objects", "[printing]") { REQUIRE_NOTHROW(BillyObjects::billy_object_to_string(object)); } } + +TEST_CASE("[Z] Cleaning after all tests", "[cleaning]") { + namespace fs = std::filesystem; + const auto pwd = is_directory(fs::current_path()) ? + fs::directory_iterator(fs::current_path()) : + fs::directory_iterator(fs::current_path().root_directory()); + for (const auto &entry: pwd) { + if (entry.is_regular_file() && entry.path().extension() == ".json") { + fs::remove(entry); + } + } +}