diff options
| author | Italo Felipe <121637958+Italo-Felipe-dev@users.noreply.github.com> | 2026-11-23 14:03:38 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-23 11:03:38 -0600 |
| commit | 2c7095ddf55c1cf426e43b5a1d2e92e2d68df685 (patch) | |
| tree | 1a8f6ff25b67796061e405ec728e028033a69df3 /runtime/test/mods_test.cpp | |
| parent | 1ce6eb5f58600a23cf717c8b4b5b297109e6f989 (diff) | |
fix(test): isolate mods scratch directory per process (#6660)
Squash-merged after diff review of PR #6660
Diffstat (limited to 'runtime/test/mods_test.cpp')
| -rw-r--r-- | runtime/test/mods_test.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/test/mods_test.cpp b/runtime/test/mods_test.cpp index cfbc6e694..a29979b25 100644 --- a/runtime/test/mods_test.cpp +++ b/runtime/test/mods_test.cpp | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | // mods.h: mod.json manifests and archetype swaps (docs/modding.md). No game files. | 1 | // mods.h: mod.json manifests and archetype swaps (docs/modding.md). No game files. |
| 2 | #include "../src/mods.h" | 2 | #include "../src/mods.h" |
| 3 | #include "test_temp_dir.h" | ||
| 3 | 4 | ||
| 4 | #include <cstdio> | 5 | #include <cstdio> |
| 5 | #include <filesystem> | 6 | #include <filesystem> |
| @@ -133,8 +134,8 @@ int main() { | |||
| 133 | set_active_camera(camera_of({})); | 134 | set_active_camera(camera_of({})); |
| 134 | check(override_view_mode(3, 0) == 3, "with no camera mod the game's view mode passes through"); | 135 | check(override_view_mode(3, 0) == 3, "with no camera mod the game's view mode passes through"); |
| 135 | 136 | ||
| 136 | const auto dir = std::filesystem::temp_directory_path() / "leonida_mods_test"; | 137 | const testfiles::ScratchDir scratch("leonida_mods_test"); |
| 137 | std::filesystem::remove_all(dir); | 138 | const auto& dir = scratch.path(); |
| 138 | write(dir / "a_mandy" / "mod.json", | 139 | write(dir / "a_mandy" / "mod.json", |
| 139 | R"({"name":"Mandy","archetype_swaps":[{"from":"player_story000_00","to":"cs_mandy","when":"always"}]})"); | 140 | R"({"name":"Mandy","archetype_swaps":[{"from":"player_story000_00","to":"cs_mandy","when":"always"}]})"); |
| 140 | write(dir / "b_off" / "mod.json", | 141 | write(dir / "b_off" / "mod.json", |
| @@ -156,7 +157,6 @@ int main() { | |||
| 156 | check(mandy_only.remap(0xE472B687u) == 0xD7C0CDFFu, "the Mandy mod swaps Lucia's player model for cs_mandy"); | 157 | check(mandy_only.remap(0xE472B687u) == 0xD7C0CDFFu, "the Mandy mod swaps Lucia's player model for cs_mandy"); |
| 157 | 158 | ||
| 158 | check(load_mods(dir / "missing").mods.empty(), "no mods folder is no mods"); | 159 | check(load_mods(dir / "missing").mods.empty(), "no mods folder is no mods"); |
| 159 | std::filesystem::remove_all(dir); | ||
| 160 | 160 | ||
| 161 | std::printf("mods_test: %d checks, %d failures\n", g_checks, g_failures); | 161 | std::printf("mods_test: %d checks, %d failures\n", g_checks, g_failures); |
| 162 | return g_failures == 0 ? 0 : 1; | 162 | return g_failures == 0 ? 0 : 1; |