Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
2daab5a4
Commit
2daab5a4
authored
Sep 11, 2016
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed #306
parent
8ea0ee50
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
3 deletions
+24
-3
README.md
README.md
+1
-1
json.hpp
src/json.hpp
+1
-1
json.hpp.re2c
src/json.hpp.re2c
+1
-1
broken_file.json
test/data/regression/broken_file.json
+2
-0
working_file.json
test/data/regression/working_file.json
+2
-0
unit-regression.cpp
test/src/unit-regression.cpp
+17
-0
No files found.
README.md
View file @
2daab5a4
...
@@ -512,7 +512,7 @@ To compile and run the tests, you need to execute
...
@@ -512,7 +512,7 @@ To compile and run the tests, you need to execute
$ make check
$ make check
===============================================================================
===============================================================================
All tests passed (890515
4
assertions in 35 test cases)
All tests passed (890515
8
assertions in 35 test cases)
```
```
For more information, have a look at the file
[
.travis.yml
](
https://github.com/nlohmann/json/blob/master/.travis.yml
)
.
For more information, have a look at the file
[
.travis.yml
](
https://github.com/nlohmann/json/blob/master/.travis.yml
)
.
src/json.hpp
View file @
2daab5a4
...
@@ -8592,7 +8592,7 @@ basic_json_parser_63:
...
@@ -8592,7 +8592,7 @@ basic_json_parser_63:
const
auto
offset_cursor
=
m_cursor
-
m_start
;
const
auto
offset_cursor
=
m_cursor
-
m_start
;
// no stream is used or end of file is reached
// no stream is used or end of file is reached
if
(
m_stream
==
nullptr
or
not
*
m_stream
)
if
(
m_stream
==
nullptr
or
m_stream
->
eof
()
)
{
{
// copy unprocessed characters to line buffer
// copy unprocessed characters to line buffer
m_line_buffer
.
clear
();
m_line_buffer
.
clear
();
...
...
src/json.hpp.re2c
View file @
2daab5a4
...
@@ -7889,7 +7889,7 @@ class basic_json
...
@@ -7889,7 +7889,7 @@ class basic_json
const auto offset_cursor = m_cursor - m_start;
const auto offset_cursor = m_cursor - m_start;
// no stream is used or end of file is reached
// no stream is used or end of file is reached
if (m_stream == nullptr or
not * m_stream
)
if (m_stream == nullptr or
m_stream->eof()
)
{
{
// copy unprocessed characters to line buffer
// copy unprocessed characters to line buffer
m_line_buffer.clear();
m_line_buffer.clear();
...
...
test/data/regression/broken_file.json
0 → 100644
View file @
2daab5a4
{
"AmbientOcclusion"
:
false
,
"AnisotropicFiltering"
:
16
,
"FOV"
:
90
,
"FullScreen"
:
true
,
"MipmapLevel"
:
4
,
"RenderDistance"
:
4
,
"VSync"
:
true
,
"WindowResX"
:
1920
,
"WindowResY"
:
1080
}
\ No newline at end of file
test/data/regression/working_file.json
0 → 100644
View file @
2daab5a4
{
"AmbientOcclusion"
:
false
,
"AnisotropicFiltering"
:
16
,
"FOV"
:
90
,
"FullScreen"
:
true
,
"MipmapLevel"
:
4
,
"RenderDistance"
:
4
,
"VSync"
:
true
,
"WindowResX"
:
1920
,
"WindowResY"
:
1080
}
\ No newline at end of file
test/src/unit-regression.cpp
View file @
2daab5a4
...
@@ -31,6 +31,8 @@ SOFTWARE.
...
@@ -31,6 +31,8 @@ SOFTWARE.
#include "json.hpp"
#include "json.hpp"
using
nlohmann
::
json
;
using
nlohmann
::
json
;
#include <fstream>
TEST_CASE
(
"regression tests"
)
TEST_CASE
(
"regression tests"
)
{
{
SECTION
(
"issue #60 - Double quotation mark is not parsed correctly"
)
SECTION
(
"issue #60 - Double quotation mark is not parsed correctly"
)
...
@@ -440,4 +442,19 @@ TEST_CASE("regression tests")
...
@@ -440,4 +442,19 @@ TEST_CASE("regression tests")
CHECK
(
at_integer
==
val_integer
);
CHECK
(
at_integer
==
val_integer
);
}
}
SECTION
(
"issue #306 - Parsing fails without space at end of file"
)
{
for
(
auto
filename
:
{
"test/data/regression/broken_file.json"
,
"test/data/regression/working_file.json"
})
{
CAPTURE
(
filename
);
json
j
;
std
::
ifstream
f
(
filename
);
CHECK_NOTHROW
(
j
<<
f
);
}
}
}
}
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