Bläddra i källkod

test-fix: allow for CMake to provide the testdir

Sam Jaffe 2 veckor sedan
förälder
incheckning
0e4dfd7965
2 ändrade filer med 8 tillägg och 1 borttagningar
  1. 1 1
      Makefile
  2. 7 0
      tests/json_schema_test_suite.h

+ 1 - 1
Makefile

@@ -10,7 +10,7 @@ endif
 CXX := clang++
 
 CXX_FLAGS := -Wall -Wextra -Werror -std=c++20 \
-	     -isystem include/ -I/opt/homebrew/opt/icu4c/include \
+	     -isystem include/ -I/opt/homebrew/include -I/opt/homebrew/opt/icu4c/include \
 	     -DJVALIDATE_USE_EXCEPTIONS -DJVALIDATE_LOAD_FAILURE_AS_FALSE_SCHEMA
 
 LD_FLAGS := -L/opt/homebrew/lib -L/opt/homebrew/opt/icu4c/lib -licuuc -licui18n -lada-idna

+ 7 - 0
tests/json_schema_test_suite.h

@@ -8,12 +8,19 @@
 
 using SchemaParams = std::tuple<jvalidate::schema::Version, std::filesystem::path>;
 
+#if !defined(JVALIDATE_JSON_SCHEMA_TEST_SUITE_DIR)
 inline std::filesystem::path const & JSONSchemaTestSuiteDir() {
   static auto const g_root =
       std::filesystem::path(__FILE__).parent_path().parent_path().parent_path();
   static auto const g_path = g_root / "thirdparty" / "JSON-Schema-Test-Suite";
   return g_path;
 }
+#else
+inline std::filesystem::path const & JSONSchemaTestSuiteDir() {
+  static std::filesystem::path const g_path = JVALIDATE_JSON_SCHEMA_TEST_SUITE_DIR;
+  return g_path;
+}
+#endif
 
 inline std::string to_string(jvalidate::schema::Version version) {
   std::stringstream ss;