From 004ee3aafb6beb4e984877186bced560010f4ddb Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 22 Nov 2024 21:57:08 +0100 Subject: fix RenderSystem unit test path resolution + reset Config before each test --- src/test/AssetTest.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/test/AssetTest.cpp') diff --git a/src/test/AssetTest.cpp b/src/test/AssetTest.cpp index 8aa7629..c3c166c 100644 --- a/src/test/AssetTest.cpp +++ b/src/test/AssetTest.cpp @@ -7,20 +7,16 @@ using namespace std; using namespace crepe; using namespace testing; -class AssetTest : public Test { -public: - Config & cfg = Config::get_instance(); - void SetUp() override { this->cfg.asset.root_pattern = ".crepe-root"; } -}; - -TEST_F(AssetTest, Existant) { ASSERT_NO_THROW(Asset{"asset/texture/img.png"}); } +TEST(AssetTest, Existant) { ASSERT_NO_THROW(Asset{"asset/texture/img.png"}); } -TEST_F(AssetTest, Nonexistant) { ASSERT_ANY_THROW(Asset{"asset/nonexistant"}); } +TEST(AssetTest, Nonexistant) { ASSERT_ANY_THROW(Asset{"asset/nonexistant"}); } -TEST_F(AssetTest, Rootless) { +TEST(AssetTest, Rootless) { + Config & cfg = Config::get_instance(); cfg.asset.root_pattern.clear(); string arbitrary = "\\/this is / /../passed through as-is"; Asset asset{arbitrary}; ASSERT_EQ(arbitrary, asset.get_path()); } + -- cgit v1.2.3 From ba8c5d5feae48036405f3cdd920dac421fdb6184 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Sun, 24 Nov 2024 18:56:41 +0100 Subject: `make format` --- src/test/AssetTest.cpp | 1 - src/test/main.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'src/test/AssetTest.cpp') diff --git a/src/test/AssetTest.cpp b/src/test/AssetTest.cpp index c3c166c..93fd6a9 100644 --- a/src/test/AssetTest.cpp +++ b/src/test/AssetTest.cpp @@ -19,4 +19,3 @@ TEST(AssetTest, Rootless) { Asset asset{arbitrary}; ASSERT_EQ(arbitrary, asset.get_path()); } - diff --git a/src/test/main.cpp b/src/test/main.cpp index e03a989..aece72d 100644 --- a/src/test/main.cpp +++ b/src/test/main.cpp @@ -28,4 +28,3 @@ int main(int argc, char ** argv) { return RUN_ALL_TESTS(); } - -- cgit v1.2.3