Commit Graph

1363 Commits

Author SHA1 Message Date
bcsgh
91f1553f2c Make throwRuntimeError/throwLogicError print msg when built with JSON_USE_EXCEPTION=0 2020-04-24 13:40:51 -05:00
Christopher Dunn
5813ab1bc1 Merge branch 'fixup-tests' into 'master' (#1102) 2020-04-24 13:06:44 -05:00
Christopher Dunn
a0b8c3ecb4 Do not run colliding tests at same time 2020-04-24 12:43:17 -05:00
Jordan Bayles
b349221938 Cleanup test configurations 2020-04-24 12:43:17 -05:00
Jordan Bayles
9e23f66f61 Issue 1102: Fixup test suite, fix broken tests
A recent PR broken the JsonChecker tests by adding support for trailing
commas. This didn't end up breaking the build, because those tests
aren't run, except locally and only using CMake.

This patch fixes the tests by adding exclusions for trailing comma
tests, as well as updates Meson to run these tests as part of `ninja
test`.

See issue #1102.
2020-04-24 12:43:17 -05:00
Christopher Dunn
411d88fae8 Stop checking status; raise instead 2020-04-24 12:43:17 -05:00
Christopher Dunn
1ff6bb65a0 ninja test 2020-04-24 12:43:17 -05:00
Ben Boeckel
8b20b7a317 amalgamate: add version.h and allocator.h to the forwards header
Required to get JSONCPP_USING_SECURE_MEMORY and the SecureAllocator
available for the definition of Allocator.
2020-04-23 23:22:10 -05:00
Stefano Fiorentino
2e54e8ff1c
adding myself to AUTHORS as per commits (#1109)
commits:
ff923658c4
5907cef86c
2020-04-23 22:52:56 -05:00
Rosen Penev
90ca694e46
clang-tidy fixes again (#1155)
* [clang-tidy] remove redundant string initialization

Found with readability-redundant-string-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] switch to raw strings

Easier to read.

Found with modernize-raw-string-literal

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] fix performance issues

Found with performance*

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* fix extra comma warnings

Found with clang's -Wextra-semi-stmt

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* remove JSONCPP_OP_EXPLICIT

This codebase in C++11. No need for compatibility with C++98.

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* remove JSONCPP_NOEXCEPT

This codebase is C++11 now. No need for this macro.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-12 01:26:04 -04:00
Chen
3beb37ea14
revert trailing comma in old Reader (#1126) 2020-02-13 13:25:08 -08:00
David Gobbi
dc180eb25e
Remove '=delete' from template methods for Xcode 8 (#1133)
For Apple clang-800.0.42.1, which was released with Xcode 8 in
September 2016, the '=delete' on the 'is' and 'as' methods causes
the following errors for value.h:

  inline declaration of 'as<bool>' follows non-inline definition
  inline declaration of 'is<bool>' follows non-inline definition

etcetera for the other specializations of 'is' and 'as'.  The same
problem also occurs for clang-3.8 but not clang-3.9 or later.
2020-02-13 13:22:49 -08:00
Claus Klein
a6fe8e27d8
Use ccache right (#1139)
* Prevent cmakelint warnings

Use 4 spaces for indent, no tabs

* Use ccache right

fix indents too at CMakeLists.txt
2020-02-13 13:20:46 -08:00
Rosen Penev
edf528edfa
clang-tidy fixes again (#1087)
* [clang-tidy] Do not use else after return

Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Convert several loops to be range based

Found with modernize-loop-convert

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Replace deprecated C headers

Found with modernize-deprecated-headers

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* [clang-tidy] Use auto where applicable

Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* .clang-tidy: Add these checks
2020-02-02 23:03:45 -05:00
Chen
6317f9a406
fix compile warnning using cmake (#1132) 2020-01-20 17:12:35 +08:00
David Seifert
6bc55ec35d Meson updates (#1124)
* Modernize meson.build

* Make tests optional
* Use `files()` for quick sanity checks

* Bump version to 1.9.3

* Bump SOVERSION, as some functions were removed
  and structs were changed, as determined by
  libabigail.
2020-01-07 09:23:50 +08:00
Andrew Childs
f11611c878 json_writer: fix inverted sense in isAnyCharRequiredQuoting (#1120)
This bug is only affects platforms where `char` is unsigned.

When char is a signed type, values >= 0x80 are also considered < 0,
and hence require escaping due to the < ' ' condition.

When char is an unsigned type, values >= 0x80 match none of the
conditions and are considered safe to emit without escaping.

This shows up as a test failure:

* Detail of EscapeSequenceTest/writeEscapeSequence test failure:
/build/source/src/test_lib_json/main.cpp(3370): expected == result
  Expected: '["\"","\\","\b","\f","\n","\r","\t","\u0278","\ud852\udf62"]
  '
  Actual  : '["\"","\\","\b","\f","\n","\r","\t","ɸ","𤭢"]
  '
2019-12-28 15:04:24 +08:00
Chen
8f7f35c5cd
Replace Raw Unicode in Testcase (#1127)
* use unicode code point

* change values' order, because JSONTEST_ASSERT_EQUAL(expected, actual)
2019-12-26 16:08:17 +08:00
theirix
7e5485ab5b Add option JSONCPP_WITH_EXAMPLE (#1099)
* Add option JSONCPP_WITH_EXAMPLE

Allows to conditionally build examples as
it has been done for tests.  Useful for packaging.

* Do not build example by default
2019-12-23 11:04:44 +08:00
Chen
92d90250f2
fix Reader bug and add testcase (#1122) 2019-12-23 10:56:54 +08:00
Billy Donahue
d6c4a8fb2d tweak to avoid implicit narrowing warning. (#1114)
* tweak to avoid implicit narrowing warning.

change an int to size_t #1113

* Update main.cpp
2019-12-11 12:12:37 -08:00
Chen
a3c8642886
Add test cases for Reader (#1108)
* update testcase for reader

* add a helper function

* refactor structured error testing
2019-12-04 10:24:52 +08:00
Chen
2983f5a89a
Run Clang-tidy with modernize-use-auto (#1077)
* Run clang-tidy modify with modernize-use-auto
* Use using instead of typedef
2019-12-04 09:08:45 +08:00
Chen
a0bd9adfef
Add an insert overload function (#1110) 2019-12-03 09:13:42 +08:00
Billy Donahue
9e0d70aa66
eliminate some redundancy in test_lib_json/main.cpp (#1104)
refactor test 'CharReaderAllowDropNullTest/issue178'
2019-11-15 09:18:32 -05:00
dota17
f200239d5b
Add some testcases for charReader (#1095)
* update charReader test case

* remove C ++ compiler version switch for smart pointer

* remove comma test due to PR #1098
2019-11-15 14:51:43 +08:00
Christopher Dunn
cfc3e927fc
Merge pull request #1101 from open-source-parsers/drop_cpptl_support
Issue 1100: Drop CPPTL support
2019-11-15 00:31:06 -06:00
Jordan Bayles
a481201af1 Readd some overzealously removed code 2019-11-14 10:21:15 -08:00
Jordan Bayles
9704cedb20 Issue 1100: Drop CPPTL support
CPPTL support is no longer relevant to JsonCpp, and can be removed from
the library. This patch removes all mentions of CPPTL, by removing all
definitions and code sections conditionally compiled only when JsonCpp
is used with CPPTL. Include guards are also renamed to not refer to
CPPTL where appropriate.
2019-11-14 09:38:11 -08:00
Christopher Dunn
781eec4da8
Merge pull request #1098 from cdunn2001/allow-trailing-commas
Allow trailing comma in objects and arrays
2019-11-14 00:21:18 -06:00
Jacob Bundgaard
1c8f7d8ae5 Run clang-format 2019-11-14 00:05:24 -06:00
Jacob Bundgaard
554d961625 Allow trailing comma in arrays if dropped null placeholders are not allowed 2019-11-14 00:05:24 -06:00
Jacob Bundgaard
01db7b7430 Allow trailing comma in objects 2019-11-14 00:05:24 -06:00
Billy Donahue
d2e6a971f4
some test coverage for Value::iterator (#1093) 2019-11-12 02:16:54 -05:00
Billy Donahue
53c8e2cb3b
Issue 1066 (#1080)
Implemented `as<T>()` and `is<T>()` with accompanying tests
2019-11-11 22:43:52 -05:00
Jordan Bayles
645cd0412c Number fixes (#1053)
* cleaning up the logic for parsing numbers

* Add Testcases for new Reader in jsontestrunner
2019-11-09 11:49:16 +08:00
dota17
ff58fdcc75
Update coverage badge (#1088)
update coverage badge
change int to Json::ArrayIndex in for-loop
2019-11-07 15:25:06 +08:00
chenguoping
82b736734d add testcase for json_value.cpp to improve coverage [90+%] 2019-11-06 21:38:47 -08:00
Hans Johnson
a86e129983 ENH: Move to requiring python 3
Resolves #1081

See for more details:
https://devguide.python.org/devcycle/#end-of-life-branches
https://pythonclock.org/
2019-11-06 21:06:57 -08:00
Hans Johnson
5fb17a66b8 COMP: Remove shadow variable warning
jsoncpp/src/test_lib_json/main.cpp:2261:30: warning: declaration shadows a local variable [-Wshadow]
    Json::StyledStreamWriter writer;
                             ^
jsoncpp/src/test_lib_json/main.cpp:2237:28: note: previous declaration is here
  Json::StyledStreamWriter writer;
                           ^
2019-11-06 21:06:57 -08:00
Hans Johnson
7429bb2bfa COMP: Fix type mismatch ambiguity
jsoncpp/src/test_lib_json/main.cpp:354:31: error:
  implicit conversion changes signedness: 'int' to
  'std::__1::vector<Json::Value *, std::__1::allocator<Json::Value *> >::size_type'
  aka 'unsigned long') [-Werror,-Wsign-conversion]
    JSONTEST_ASSERT_EQUAL(vec[i], &array[i]);
                          ~~~ ^
2019-11-06 21:06:57 -08:00
Christopher Dunn
2eb20a938c Remove deprecated makerelease.py
re: #1081
2019-11-04 01:41:35 -08:00
Billy Donahue
638ad269e7 Explicitly specify hexfloat in TestResult operator<< (#1078) 2019-11-04 01:37:02 -08:00
Christopher Dunn
ec9302c4ed Avoid deprecated Meson feature
* https://mesonbuild.com/Python-3-module.html

> This module is deprecated and replaced by the python module.
2019-11-04 01:29:02 -08:00
Christopher Dunn
fb9aaf8112 Update meson/python
```
DEPRECATION: Project targetting '>= 0.41.1' but tried to use feature deprecated since '0.48.0': python3 module
Build targets in project: 3
WARNING: Deprecated features used:
 * 0.48.0: {'python3 module'}
```
2019-11-04 01:29:02 -08:00
dota17
2703c306a3
add coverage badge in readme (#1072) 2019-10-26 17:03:05 +08:00
dota17
c634b98e7d
modify README.md: add some badges (#1070) 2019-10-25 17:12:11 +08:00
dota17
6c9408d128 remove pushError in CharReader (#1055) 2019-10-23 15:31:25 -07:00
dota17
54bd178bd8 update testcases to improve coverage (#1061) 2019-10-23 15:30:34 -07:00
Jacob Bundgaard
41ffff01d3 Fix link to Amalgamated wiki article (#1064) 2019-10-18 11:06:56 -07:00