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
cb053bce
Unverified
Commit
cb053bce
authored
Aug 20, 2021
by
Niels Lohmann
Committed by
GitHub
Aug 20, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2960 from nlohmann/issue2958
Add regression test
parents
eb6541a3
97c7a35a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
test/src/unit-regression2.cpp
test/src/unit-regression2.cpp
+21
-1
No files found.
test/src/unit-regression2.cpp
View file @
cb053bce
...
...
@@ -34,7 +34,8 @@ SOFTWARE.
#define JSON_TESTS_PRIVATE
#include <nlohmann/json.hpp>
using
nlohmann
::
json
;
using
json
=
nlohmann
::
json
;
using
ordered_json
=
nlohmann
::
ordered_json
;
#include <list>
#include <cstdio>
...
...
@@ -659,6 +660,25 @@ TEST_CASE("regression tests 2")
{
static_assert
(
std
::
is_copy_assignable
<
nlohmann
::
ordered_json
>::
value
,
""
);
}
SECTION
(
"issue #2958 - Inserting in unordered json using a pointer retains the leading slash"
)
{
std
::
string
p
=
"/root"
;
// matching types
json
test1
;
test1
[
json
::
json_pointer
(
p
)]
=
json
::
object
();
CHECK
(
test1
.
dump
()
==
"{
\"
root
\"
:{}}"
);
ordered_json
test2
;
test2
[
ordered_json
::
json_pointer
(
p
)]
=
json
::
object
();
CHECK
(
test2
.
dump
()
==
"{
\"
root
\"
:{}}"
);
// mixed type - the JSON Pointer is implicitly converted into a string "/root"
ordered_json
test3
;
test3
[
json
::
json_pointer
(
p
)]
=
json
::
object
();
CHECK
(
test3
.
dump
()
==
"{
\"
/root
\"
:{}}"
);
}
}
DOCTEST_CLANG_SUPPRESS_WARNING_POP
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