1
0
mirror of https://github.com/nlohmann/json synced 2024-11-15 16:50:06 +00:00

fixed test case

This commit is contained in:
Niels 2016-04-17 22:34:39 +02:00
parent 6268287940
commit 1dee40a969
3 changed files with 13 additions and 37 deletions

View File

@ -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}

View File

@ -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}

View File

@ -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);