Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
7ade3a0e
Unverified
Commit
7ade3a0e
authored
May 01, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
➖
remove dependency to FetchContent
parent
dbf1a1f4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
+11
-17
CMakeLists.txt
test/CMakeLists.txt
+10
-16
test_data.hpp.in
test/src/test_data.hpp.in
+1
-1
No files found.
test/CMakeLists.txt
View file @
7ade3a0e
...
@@ -3,22 +3,16 @@ option(JSON_Valgrind "Execute test suite with Valgrind" OFF)
...
@@ -3,22 +3,16 @@ option(JSON_Valgrind "Execute test suite with Valgrind" OFF)
option
(
JSON_NoExceptions
"Build test suite without exceptions"
OFF
)
option
(
JSON_NoExceptions
"Build test suite without exceptions"
OFF
)
option
(
JSON_Coverage
"Build test suite with coverage information"
OFF
)
option
(
JSON_Coverage
"Build test suite with coverage information"
OFF
)
if
(
${
CMAKE_VERSION
}
VERSION_LESS
"3.11.0"
)
# target to download test data
message
(
FATAL_ERROR
"The test suite needs at least CMake 3.11. This is CMake
${
CMAKE_VERSION
}
."
)
add_custom_target
(
download_test_data
endif
()
COMMAND test -d json_test_data || git clone https://github.com/nlohmann/json_test_data.git --quiet --depth 1
COMMENT
"Downloading test data from https://github.com/nlohmann/json_test_data"
include
(
FetchContent
)
WORKING_DIRECTORY
${
CMAKE_BINARY_DIR
}
FetchContent_Declare
(
nlohmann_json_test_data
GIT_REPOSITORY https://github.com/nlohmann/json_test_data.git
GIT_SHALLOW TRUE
)
)
FetchContent_GetProperties
(
nlohmann_json_test_data
)
# test fixture to download test data
if
(
NOT nlohmann_json_test_data_POPULATED
)
add_test
(
NAME
"download_test_data"
COMMAND
${
CMAKE_COMMAND
}
--build
${
CMAKE_BINARY_DIR
}
--target download_test_data
)
message
(
STATUS
"Download test data"
)
set_tests_properties
(
download_test_data PROPERTIES FIXTURES_SETUP TEST_DATA
)
FetchContent_Populate
(
nlohmann_json_test_data
)
message
(
STATUS
"Download test data - done"
)
endif
()
configure_file
(
src/test_data.hpp.in include/test_data.hpp
)
configure_file
(
src/test_data.hpp.in include/test_data.hpp
)
...
@@ -186,13 +180,13 @@ foreach(file ${files})
...
@@ -186,13 +180,13 @@ foreach(file ${files})
COMMAND
${
testcase
}
${
DOCTEST_TEST_FILTER
}
COMMAND
${
testcase
}
${
DOCTEST_TEST_FILTER
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
)
set_tests_properties
(
"
${
testcase
}
_default"
PROPERTIES LABELS
"default"
)
set_tests_properties
(
"
${
testcase
}
_default"
PROPERTIES LABELS
"default"
FIXTURES_REQUIRED TEST_DATA
)
add_test
(
NAME
"
${
testcase
}
_all"
add_test
(
NAME
"
${
testcase
}
_all"
COMMAND
${
testcase
}
${
DOCTEST_TEST_FILTER
}
--no-skip
COMMAND
${
testcase
}
${
DOCTEST_TEST_FILTER
}
--no-skip
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
)
set_tests_properties
(
"
${
testcase
}
_all"
PROPERTIES LABELS
"all"
)
set_tests_properties
(
"
${
testcase
}
_all"
PROPERTIES LABELS
"all"
FIXTURES_REQUIRED TEST_DATA
)
if
(
JSON_Valgrind
)
if
(
JSON_Valgrind
)
add_test
(
NAME
"
${
testcase
}
_valgrind"
add_test
(
NAME
"
${
testcase
}
_valgrind"
...
...
test/src/test_data.hpp.in
View file @
7ade3a0e
#define TEST_DATA_DIRECTORY "${
nlohmann_json_test_data_SOURCE_DIR}
"
#define TEST_DATA_DIRECTORY "${
CMAKE_BINARY_DIR}/json_test_data
"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment