upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/mods_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/test/mods_test.cpp')
-rw-r--r--runtime/test/mods_test.cpp6
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;