Commit Graph

1357 Commits

Author SHA1 Message Date
Niels
25d60b7bab Merge pull request #247 from robertmrk/feature/cmake-cleanup
Define CMake/CTest tests
2016-05-18 22:20:45 +02:00
Niels
837617122a fixed #246 2016-05-18 22:17:08 +02:00
Robert Marki
639d63217e Define CMake/CTest tests
Instead of copying the test executable and the JSON files used by
the tests at install time, define CMake/CTest tests for running
the json_unit executable from any build directory with the project's
source directory as its working directory.

- call enable_testing in the main lists file to allow the definition
of tests
- remove install commands from the test directory's lists file
- define two tests
  - json_unit_default for running the default tests by executing
json_unit without any arguments
  - json_unit_all for running all the tests by executing json_unit
with the "*" argument
- update the AppVeyor configuration file to use the new testing method
2016-05-18 11:53:49 +02:00
Niels
0a393b8374 indentation cleanup 2016-05-12 07:34:36 +02:00
Niels
0e0ecb2c14 fixed a warning and update ChangeLog 2016-05-12 00:32:18 +02:00
Niels
fb06356856 thanks 2016-05-11 20:58:11 +02:00
Niels
888d022573 Merge pull request #242 from ChrisKitching/outOfTree
Out of tree builds and a few other miscellaneous CMake cleanups.
2016-05-11 20:52:45 +02:00
Niels
f1e61896fb fixed a shadow error 2016-05-11 18:43:12 +02:00
Niels
db5c9ec9ba fixed issue #239 (-Wconversion warnings) 2016-05-11 17:25:59 +02:00
Niels
91aa4c9def Merge branch 'develop' into feature/issue239 2016-05-11 17:23:01 +02:00
Chris Kitching
0e2f0c4edc
Repair appveyor... Horrifyingly
It's sort of gnarly that it's still doing in-tree builds, but I
really, _really_ don't want to get any more friendly with CMake's
Visual Studio generator to work out how to make it stop doing it.

In-tree builds still work, after all, and the goal of this work is
to make out-of-tree builds work as well. Notional horrors like
this will have to wait ;)
2016-05-11 14:02:53 +01:00
Chris Kitching
527a69bb64
Install the test binary and test data. Fixes #241
The resulting install tree, when tests are enabled, looks like this:

```
.
├── cmake
│   ├── nlohmann_jsonConfig.cmake
│   ├── nlohmann_jsonConfigVersion.cmake
│   └── nlohmann_jsonTargets.cmake
├── include
│   └── nlohmann
│       └── json.hpp
└── test
    ├── bin
    │   └── json_unit
    └── data
        ├── json_nlohmann_tests
        │   ├── all_unicode.json
        │   └── bom.json
        ├── json.org
        │   ├── 1.json
        │   ├── ...
        ├── json_roundtrip
        │   ├── roundtrip01.json
        │   ├── roundtrip02.json
        │   └── ...
        ├── json_tests
        │   ├── fail10.json
        │   └── ...
        └── json_testsuite
            └── sample.json
```

It has the property that you can invoke the test binary from the
root of the install tree and the tests work correctly (you no
longer depend on the test binary being run inside the source
tree).

If tests are disabled, the entire `test/` subtree is omitted.
Notice how that yields exactly what you want for using this
library in other projects.

I do not believe I need to update travis due to this change, as the
evil Makefile continues to do in-tree builds. I expect I'll find
out soon enough.
2016-05-11 01:43:42 +01:00
Chris Kitching
af76508fe7
Introduce structure to the test/ directory
This introduces a clear separation between test data and test
binaries. Test data is moved into test/data, and the test binaries
move into test/src. A new CMake script specific to building the
tests is introduced in /test to slightly clean up the toplevel
one.

As well as tidying things up, this makes the next step trivial...
2016-05-11 01:30:08 +01:00
Chris Kitching
4e6aacda36
Use definitely-unique target/project name
There exist lots of json libraries, and project/target names must
be globally unique. If someone integrated with this library in a
particularly stupid way, using a generic name like "json" might
cause a problem.
2016-05-11 01:14:56 +01:00
Chris Kitching
b6becce8fb
Don't use variable for the test target name
I'm not sure that using a variable for target names really helps
with clarity. Unlike paths, target names aren't really something
you change. In a sense, targets are themselves a sort of variable,
so having a variable to name a variable seems just a bit gnarly.
2016-05-11 01:12:56 +01:00
Chris Kitching
bf7b6d15c7
Unset execute bit on sample.json 2016-05-11 01:10:29 +01:00
Chris Kitching
6a98a6c964
Add CMake option to disable building the tests (Default builds) 2016-05-11 01:06:32 +01:00
Niels
9ecf83f630 working on #235 2016-05-08 20:28:20 +02:00
Niels
6d8e00ade8 another try to remove a warning 2016-05-08 17:17:17 +02:00
Niels
ac3036dc0f Merge branch 'develop' into feature/issue239 2016-05-08 17:07:08 +02:00
Niels
fadf286653 added test case for std::bad_alloc 2016-05-08 14:35:32 +02:00
Niels
85a30813c8 removed unnecessary code (numbers must not begin with "+") 2016-05-07 20:22:58 +02:00
Niels
688cd49bdc Merge branch 'feature/json-patch' into develop 2016-05-07 18:41:02 +02:00
Niels
c04275966f improved test coverage 2016-05-07 18:33:43 +02:00
Niels
9073b2ca39 hopefully removed some warnings 2016-04-30 16:22:27 +02:00
Niels
ea84a85b13 simplified flatten/unflatten examples 2016-04-30 10:39:03 +02:00
Niels
a21f8b0c77 added AppVeyor information 2016-04-30 01:21:35 +02:00
Niels
9170740f45 added documentation on Travis compilers 2016-04-30 01:01:41 +02:00
Niels
7c04bc3db6 added name call 2016-04-30 00:43:33 +02:00
Niels
be16d005e4 get compiler versions 2016-04-30 00:25:11 +02:00
Niels
f4ecceab19 cleanup 2016-04-30 00:12:19 +02:00
Niels
1d3b4dd158 added test cases 2016-04-30 00:03:47 +02:00
Niels
62f81a60d7 hopefully fixed a warning 2016-04-29 21:23:13 +02:00
Niels
82f5332cf4 Merge branch 'develop' into feature/json-patch 2016-04-29 20:50:34 +02:00
Niels
74544b42af removed MinGW compiler (too old) 2016-04-29 20:48:47 +02:00
Niels
c019088d3b wrong MinGW binary 2016-04-29 20:35:40 +02:00
Niels
b685737d53 added MinGW 2016-04-29 20:18:20 +02:00
Niels
ddc5442c91 cleanup 2016-04-29 20:09:41 +02:00
Niels
a07cdb14ec don't install valgrind for OSX 2016-04-29 20:01:11 +02:00
Niels
40abeb28d5 Valgrind only for Linux 2016-04-29 20:00:33 +02:00
Niels
68c50073a4 added OSX 2016-04-29 19:46:37 +02:00
Niels
ca604c5a2e trying Clang 3.9 2016-04-29 19:37:52 +02:00
Niels
86d7e3090f removed GCC 6, added Clang 3.5 2016-04-29 19:33:43 +02:00
Niels
e35805cf3a added GCC 6 and Clang 3.8 to Travis 2016-04-29 19:29:02 +02:00
Niels
86debab3b1 Merge branch 'develop' into feature/json-patch 2016-04-26 20:43:02 +02:00
Niels
9af8f7d094 update after #238 2016-04-26 20:38:01 +02:00
Niels
7dc07b75de Merge branch 'develop' into feature/json-patch 2016-04-26 20:32:24 +02:00
Niels
0f64761663 Merge pull request #238 from robertmrk/cmake-package
Implement additional integration options
2016-04-26 20:31:19 +02:00
Niels
5e0bf75d60 cleanup, test, and diff 2016-04-25 23:17:04 +02:00
Robert Marki
192a692034 Generate package config files in cmake's current binary directory
Generate the config files of the package in CMAKE_CURRENT_BINARY_DIR
instead of CMAKE_BINARY_DIR because the later will refer to the main
project's binary directory if the library is included in the project
using the add_subdirectory command.
2016-04-25 11:55:03 +02:00