Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
1dee40a9
Commit
1dee40a9
authored
Apr 17, 2016
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed test case
parent
62682879
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
37 deletions
+13
-37
src/json.hpp
src/json.hpp
+6
-18
src/json.hpp.re2c
src/json.hpp.re2c
+6
-18
test/unit.cpp
test/unit.cpp
+1
-1
No files found.
src/json.hpp
View file @
1dee40a9
...
...
@@ -8986,25 +8986,15 @@ basic_json_parser_63:
}
/*
This function is only to be called from the unflatten()
function. There, j is initially of type null.
- In case the reference tokens are empty, a reference to
j is returned and overwritten by the desired value by
the unflatten() function.
- If there are reference tokens, the null value of j will
be changed to an object or array after reading the first
reference token.
- All subsequent tokens work on arrays or objects and will
not change the type of j.
Consequently, the type of @a j will always be null,
object, or array. Hence, the following line is
unreachable.
The following code is only reached if there exists a
reference token _and_ the current value is primitive. In
this case, we have an error situation, because primitive
values may only occur as single value; that is, with an
empty list of reference tokens.
*/
default:
{
break
;
// LCOV_EXCL_LINE
throw
std
::
domain_error
(
"invalid value to unflatten"
);
}
}
}
...
...
@@ -9462,8 +9452,6 @@ basic_json_parser_63:
@complexity Linear in the size the JSON value.
@throws std::domain_error
@liveexample{The following code shows how a flattened JSON object is
unflattened into the original nested JSON object.,unflatten}
...
...
src/json.hpp.re2c
View file @
1dee40a9
...
...
@@ -8296,25 +8296,15 @@ class basic_json
}
/*
This function is only to be called from the unflatten()
function. There, j is initially of type null.
- In case the reference tokens are empty, a reference to
j is returned and overwritten by the desired value by
the unflatten() function.
- If there are reference tokens, the null value of j will
be changed to an object or array after reading the first
reference token.
- All subsequent tokens work on arrays or objects and will
not change the type of j.
Consequently, the type of @a j will always be null,
object, or array. Hence, the following line is
unreachable.
The following code is only reached if there exists a
reference token _and_ the current value is primitive. In
this case, we have an error situation, because primitive
values may only occur as single value; that is, with an
empty list of reference tokens.
*/
default:
{
break; // LCOV_EXCL_LINE
throw std::domain_error("invalid value to unflatten");
}
}
}
...
...
@@ -8772,8 +8762,6 @@ class basic_json
@complexity Linear in the size the JSON value.
@throws std::domain_error
@liveexample{The following code shows how a flattened JSON object is
unflattened into the original nested JSON object.,unflatten}
...
...
test/unit.cpp
View file @
1dee40a9
...
...
@@ -12368,7 +12368,7 @@ TEST_CASE("JSON pointers")
// error for conflicting values
json
j_error
=
{{
""
,
42
},
{
"/foo"
,
17
}};
CHECK_THROWS_AS
(
j_error
.
unflatten
(),
std
::
domain_error
);
CHECK_THROWS_WITH
(
j_error
.
unflatten
(),
"
unresolved reference token 'foo'
"
);
CHECK_THROWS_WITH
(
j_error
.
unflatten
(),
"
invalid value to unflatten
"
);
// explicit roundtrip check
CHECK
(
j
.
flatten
().
unflatten
()
==
j
);
...
...
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