Removing any useless file after all tests

This commit is contained in:
Pcornat 2024-09-02 13:40:17 +02:00
parent 75f8db9f5a
commit e061279654
Signed by: Pcornat
GPG Key ID: E0326CC678A00BDD

View File

@ -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);
}
}
}