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
8014637a
Commit
8014637a
authored
Nov 24, 2016
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✅
added a test for EOF error (#367)
parent
dfc49e7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+15
-0
No files found.
test/src/unit-regression.cpp
View file @
8014637a
...
...
@@ -495,4 +495,19 @@ TEST_CASE("regression tests")
json
j
=
json
::
parse
(
"22e2222"
);
CHECK
(
j
==
json
());
}
SECTION
(
"issue #367 - calling stream at EOF"
)
{
std
::
stringstream
ss
;
json
j
;
ss
<<
"123"
;
CHECK_NOTHROW
(
j
<<
ss
);
// see https://github.com/nlohmann/json/issues/367#issuecomment-262841893:
// ss is not at EOF; this yielded an error before the fix
// (threw basic_string::append). No, it should just throw
// a parse error because of the EOF.
CHECK_THROWS_AS
(
j
<<
ss
,
std
::
invalid_argument
);
CHECK_THROWS_WITH
(
j
<<
ss
,
"parse error - unexpected end of input"
);
}
}
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