Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Goubermouche committed Jan 31, 2024
1 parent 97cf52b commit 9841fd8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
Empty file removed source/tests/app_STDERR.txt
Empty file.
1 change: 0 additions & 1 deletion source/tests/app_STDOUT.txt

This file was deleted.

26 changes: 25 additions & 1 deletion source/tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,26 @@ i32 run_all_tests(const parametric::parameters& params) {
std::queue<filepath> paths({ test_directory.get_canonical_path() });
bool encountered_error = false;

// initialize our files
try {
utility::fs::create(COMPILER_STDOUT);
utility::fs::create(COMPILER_STDERR);
utility::fs::create(CLANG_STDOUT);
utility::fs::create(CLANG_STDERR);
utility::fs::create(APP_STDOUT);
utility::fs::create(APP_STDERR);
utility::fs::create(OBJECT_FILE);
utility::fs::create(EXECUTABLE_FILE);
}
catch (const std::exception& exception) {
utility::console::printerr("error: {}\n", exception.what());
encountered_error = true;
}

if(encountered_error) {
return 1;
}

// run our tests
try {
while (!paths.empty()) {
Expand All @@ -147,7 +167,7 @@ i32 run_all_tests(const parametric::parameters& params) {
// only compile .s files
encountered_error |= run_test(path, compiler_path);
}
});
});
}
}
catch (const std::exception& exception) {
Expand All @@ -159,6 +179,10 @@ i32 run_all_tests(const parametric::parameters& params) {
try {
utility::fs::remove(COMPILER_STDOUT);
utility::fs::remove(COMPILER_STDERR);
utility::fs::remove(CLANG_STDOUT);
utility::fs::remove(CLANG_STDERR);
utility::fs::remove(APP_STDOUT);
utility::fs::remove(APP_STDERR);
utility::fs::remove(OBJECT_FILE);
utility::fs::remove(EXECUTABLE_FILE);
}
Expand Down
6 changes: 6 additions & 0 deletions source/utility/filesystem/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,11 @@ namespace utility {
inline auto remove(const filepath& path) -> bool {
return std::filesystem::remove(path.get_path());
}

void create(const filepath& path) {
// TODO: add error checking
std::ofstream file(path.get_path());
file.close();
}
}
} // namespace utility::fs

0 comments on commit 9841fd8

Please sign in to comment.