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
951a7a64
Unverified
Commit
951a7a64
authored
Oct 22, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚧
fixed test cases #1198
parent
c51b1e6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
test/src/unit-serialization.cpp
test/src/unit-serialization.cpp
+6
-3
test/src/unit-unicode.cpp
test/src/unit-unicode.cpp
+0
-1
No files found.
test/src/unit-serialization.cpp
View file @
951a7a64
...
@@ -106,7 +106,8 @@ TEST_CASE("serialization")
...
@@ -106,7 +106,8 @@ TEST_CASE("serialization")
CHECK_THROWS_AS
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
json
::
type_error
&
);
CHECK_THROWS_AS
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
json
::
type_error
&
);
CHECK_THROWS_WITH
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
"[json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9"
);
CHECK_THROWS_WITH
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
"[json.exception.type_error.316] invalid UTF-8 byte at index 2: 0xA9"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
ignore
)
==
"
\"
äü
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
ignore
)
==
"
\"
äü
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
replace
)
==
"
\"
ä
\\
ufffdü
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
replace
)
==
"
\"
ä
\xEF\xBF\xBD
ü
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
true
,
json
::
error_handler_t
::
replace
)
==
"
\"\\
u00e4
\\
ufffd
\\
u00fc
\"
"
);
}
}
SECTION
(
"ending with incomplete character"
)
SECTION
(
"ending with incomplete character"
)
...
@@ -117,7 +118,8 @@ TEST_CASE("serialization")
...
@@ -117,7 +118,8 @@ TEST_CASE("serialization")
CHECK_THROWS_WITH
(
j
.
dump
(),
"[json.exception.type_error.316] incomplete UTF-8 string; last byte: 0xC2"
);
CHECK_THROWS_WITH
(
j
.
dump
(),
"[json.exception.type_error.316] incomplete UTF-8 string; last byte: 0xC2"
);
CHECK_THROWS_AS
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
json
::
type_error
&
);
CHECK_THROWS_AS
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
json
::
type_error
&
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
ignore
)
==
"
\"
123
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
ignore
)
==
"
\"
123
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
replace
)
==
"
\"
123
\\
ufffd
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
replace
)
==
"
\"
123
\xEF\xBF\xBD\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
true
,
json
::
error_handler_t
::
replace
)
==
"
\"
123
\\
ufffd
\"
"
);
}
}
SECTION
(
"unexpected character"
)
SECTION
(
"unexpected character"
)
...
@@ -128,7 +130,8 @@ TEST_CASE("serialization")
...
@@ -128,7 +130,8 @@ TEST_CASE("serialization")
CHECK_THROWS_WITH
(
j
.
dump
(),
"[json.exception.type_error.316] invalid UTF-8 byte at index 5: 0x34"
);
CHECK_THROWS_WITH
(
j
.
dump
(),
"[json.exception.type_error.316] invalid UTF-8 byte at index 5: 0x34"
);
CHECK_THROWS_AS
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
json
::
type_error
&
);
CHECK_THROWS_AS
(
j
.
dump
(
1
,
' '
,
false
,
json
::
error_handler_t
::
strict
),
json
::
type_error
&
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
ignore
)
==
"
\"
123456
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
ignore
)
==
"
\"
123456
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
replace
)
==
"
\"
123
\\
ufffd456
\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
false
,
json
::
error_handler_t
::
replace
)
==
"
\"
123
\xEF\xBF\xBD\x34\x35\x36\"
"
);
CHECK
(
j
.
dump
(
-
1
,
' '
,
true
,
json
::
error_handler_t
::
replace
)
==
"
\"
123
\\
ufffd456
\"
"
);
}
}
}
}
}
}
test/src/unit-unicode.cpp
View file @
951a7a64
...
@@ -100,7 +100,6 @@ void check_utf8dump(bool success_expected, int byte1, int byte2 = -1, int byte3
...
@@ -100,7 +100,6 @@ void check_utf8dump(bool success_expected, int byte1, int byte2 = -1, int byte3
// check that replace string contains a replacement character
// check that replace string contains a replacement character
CHECK
(
s_replaced
.
find
(
"
\xEF\xBF\xBD
"
)
!=
std
::
string
::
npos
);
CHECK
(
s_replaced
.
find
(
"
\xEF\xBF\xBD
"
)
!=
std
::
string
::
npos
);
}
}
// check that prefix and suffix are preserved
// check that prefix and suffix are preserved
...
...
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