mirror of
https://github.com/nlohmann/json.git
synced 2026-10-03 13:10:33 +00:00
Fix CI: json_view access tests without exceptions and on clang 3.6
- ci_test_noexceptions: the element access tests compare the exceptions of json_view and basic_json through exception_of(), which catches them outside a CHECK_THROWS; with JSON_NOEXCEPTION the first one aborted the test. Compile those comparisons only with exceptions. - clang 3.6: value-initialize a const json_view, as in the tests of json-view/10-view-document. - Format three new documentation examples with the pinned astyle, which the "check" job runs once it gets past the amalgamation step. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -15,7 +15,7 @@ int main()
|
||||
const auto values = measurements.root();
|
||||
|
||||
const int sum = std::accumulate(values.cbegin(), values.cend(), 0,
|
||||
[](int total, const json_view & v)
|
||||
[](int total, const json_view & v)
|
||||
{
|
||||
return total + v.materialize().get<int>();
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ int main()
|
||||
const auto records = batch.root();
|
||||
|
||||
const bool all_objects = std::all_of(records.cbegin(), records.cend(),
|
||||
[](const json_view & v)
|
||||
[](const json_view & v)
|
||||
{
|
||||
return v.is_object();
|
||||
});
|
||||
|
||||
@@ -13,7 +13,10 @@ int main()
|
||||
json_document bad = json_document::parse("[1, 2, 3]");
|
||||
json_document failed = json_document::parse("not json", /* allow_exceptions */ false);
|
||||
|
||||
for (const json_view v : { good.root(), bad.root(), failed.root() })
|
||||
for (const json_view v :
|
||||
{
|
||||
good.root(), bad.root(), failed.root()
|
||||
})
|
||||
{
|
||||
if (v.is_object())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user