From 24c003b33368d527c75f515e687b911893198fc0 Mon Sep 17 00:00:00 2001 From: Nik Date: Wed, 14 Sep 2022 14:29:12 +0200 Subject: [PATCH] tests: Disable imhex checks in unit tests --- includes/hex/impl/imhex_check.pat | 8 ++++++-- tests/includes/source/main.cpp | 2 ++ tests/patterns/source/main.cpp | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/hex/impl/imhex_check.pat b/includes/hex/impl/imhex_check.pat index 6ed3c88..80b8989 100644 --- a/includes/hex/impl/imhex_check.pat +++ b/includes/hex/impl/imhex_check.pat @@ -1,3 +1,7 @@ -#ifndef __IMHEX__ - #error This library is only available in the ImHex Hex editor +#ifndef __PL_UNIT_TESTS__ + #ifndef __IMHEX__ + + #error This library is only available in the ImHex Hex editor + + #endif #endif \ No newline at end of file diff --git a/tests/includes/source/main.cpp b/tests/includes/source/main.cpp index 6dd4ae0..9359497 100644 --- a/tests/includes/source/main.cpp +++ b/tests/includes/source/main.cpp @@ -46,6 +46,8 @@ int main(int argc, char **argv) { runtime.addPragma("eval_depth", DummyPragmaHandler); runtime.addPragma("array_limit", DummyPragmaHandler); runtime.addPragma("pattern_limit", DummyPragmaHandler); + + runtime.addDefine("__PL_UNIT_TESTS__"); } // Execute pattern diff --git a/tests/patterns/source/main.cpp b/tests/patterns/source/main.cpp index 57d10bc..9220afe 100644 --- a/tests/patterns/source/main.cpp +++ b/tests/patterns/source/main.cpp @@ -48,6 +48,7 @@ int main(int argc, char **argv) { runtime.setDangerousFunctionCallHandler([]{ return true; }); runtime.setIncludePaths({ includePath }); runtime.addPragma("MIME", DummyPragmaHandler); + runtime.addDefine("__PL_UNIT_TESTS__"); } // Execute pattern