Commit ad053ef0 by Ben Berman

Fix tests for improved error 305(hopefully)

parent bbdfe7de
...@@ -195,7 +195,7 @@ TEST_CASE("element access 1") ...@@ -195,7 +195,7 @@ TEST_CASE("element access 1")
const json j_nonarray_const(j_nonarray); const json j_nonarray_const(j_nonarray);
CHECK_NOTHROW(j_nonarray[0]); CHECK_NOTHROW(j_nonarray[0]);
CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&); CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with null"); CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with null");
} }
SECTION("implicit transformation to properly filled array") SECTION("implicit transformation to properly filled array")
...@@ -212,8 +212,8 @@ TEST_CASE("element access 1") ...@@ -212,8 +212,8 @@ TEST_CASE("element access 1")
const json j_nonarray_const(j_nonarray); const json j_nonarray_const(j_nonarray);
CHECK_THROWS_AS(j_nonarray[0], json::type_error&); CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&); CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with boolean"); CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with boolean");
CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with boolean"); CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with boolean");
} }
SECTION("string") SECTION("string")
...@@ -222,8 +222,8 @@ TEST_CASE("element access 1") ...@@ -222,8 +222,8 @@ TEST_CASE("element access 1")
const json j_nonarray_const(j_nonarray); const json j_nonarray_const(j_nonarray);
CHECK_THROWS_AS(j_nonarray[0], json::type_error&); CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&); CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with string"); CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with string");
CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with string"); CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with string");
} }
SECTION("object") SECTION("object")
...@@ -232,8 +232,8 @@ TEST_CASE("element access 1") ...@@ -232,8 +232,8 @@ TEST_CASE("element access 1")
const json j_nonarray_const(j_nonarray); const json j_nonarray_const(j_nonarray);
CHECK_THROWS_AS(j_nonarray[0], json::type_error&); CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&); CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with object"); CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with object");
CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with object"); CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with object");
} }
SECTION("number (integer)") SECTION("number (integer)")
...@@ -242,8 +242,8 @@ TEST_CASE("element access 1") ...@@ -242,8 +242,8 @@ TEST_CASE("element access 1")
const json j_nonarray_const(j_nonarray); const json j_nonarray_const(j_nonarray);
CHECK_THROWS_AS(j_nonarray[0], json::type_error&); CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&); CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with number"); CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with number");
CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with number"); CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with number");
} }
SECTION("number (unsigned)") SECTION("number (unsigned)")
...@@ -252,8 +252,8 @@ TEST_CASE("element access 1") ...@@ -252,8 +252,8 @@ TEST_CASE("element access 1")
const json j_nonarray_const(j_nonarray); const json j_nonarray_const(j_nonarray);
CHECK_THROWS_AS(j_nonarray[0], json::type_error&); CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&); CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with number"); CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with number");
CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with number"); CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with number");
} }
SECTION("number (floating-point)") SECTION("number (floating-point)")
...@@ -262,8 +262,8 @@ TEST_CASE("element access 1") ...@@ -262,8 +262,8 @@ TEST_CASE("element access 1")
const json j_nonarray_const(j_nonarray); const json j_nonarray_const(j_nonarray);
CHECK_THROWS_AS(j_nonarray[0], json::type_error&); CHECK_THROWS_AS(j_nonarray[0], json::type_error&);
CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&); CHECK_THROWS_AS(j_nonarray_const[0], json::type_error&);
CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with number"); CHECK_THROWS_WITH(j_nonarray[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with number");
CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with number"); CHECK_THROWS_WITH(j_nonarray_const[0], "[json.exception.type_error.305] cannot use operator[] with a numeric argument with number");
} }
} }
} }
......
...@@ -475,9 +475,9 @@ TEST_CASE("element access 2") ...@@ -475,9 +475,9 @@ TEST_CASE("element access 2")
CHECK_NOTHROW(j_nonobject2[json::object_t::key_type("foo")]); CHECK_NOTHROW(j_nonobject2[json::object_t::key_type("foo")]);
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
CHECK_THROWS_WITH(j_const_nonobject["foo"], "[json.exception.type_error.305] cannot use operator[] with null"); CHECK_THROWS_WITH(j_const_nonobject["foo"], "[json.exception.type_error.305] cannot use operator[] with a key-style argument with null");
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with null"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with null");
} }
SECTION("boolean") SECTION("boolean")
...@@ -489,13 +489,13 @@ TEST_CASE("element access 2") ...@@ -489,13 +489,13 @@ TEST_CASE("element access 2")
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
CHECK_THROWS_WITH(j_nonobject["foo"], CHECK_THROWS_WITH(j_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with boolean"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean");
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with boolean"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean");
CHECK_THROWS_WITH(j_const_nonobject["foo"], CHECK_THROWS_WITH(j_const_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with boolean"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean");
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with boolean"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with boolean");
} }
SECTION("string") SECTION("string")
...@@ -507,13 +507,13 @@ TEST_CASE("element access 2") ...@@ -507,13 +507,13 @@ TEST_CASE("element access 2")
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
CHECK_THROWS_WITH(j_nonobject["foo"], CHECK_THROWS_WITH(j_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with string"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string");
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with string"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string");
CHECK_THROWS_WITH(j_const_nonobject["foo"], CHECK_THROWS_WITH(j_const_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with string"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string");
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with string"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with string");
} }
SECTION("array") SECTION("array")
...@@ -525,12 +525,12 @@ TEST_CASE("element access 2") ...@@ -525,12 +525,12 @@ TEST_CASE("element access 2")
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
CHECK_THROWS_WITH(j_nonobject["foo"], CHECK_THROWS_WITH(j_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with array"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array");
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], "[json.exception.type_error.305] cannot use operator[] with array"); CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array");
CHECK_THROWS_WITH(j_const_nonobject["foo"], CHECK_THROWS_WITH(j_const_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with array"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array");
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with array"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with array");
} }
SECTION("number (integer)") SECTION("number (integer)")
...@@ -542,13 +542,13 @@ TEST_CASE("element access 2") ...@@ -542,13 +542,13 @@ TEST_CASE("element access 2")
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
CHECK_THROWS_WITH(j_nonobject["foo"], CHECK_THROWS_WITH(j_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_const_nonobject["foo"], CHECK_THROWS_WITH(j_const_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
} }
SECTION("number (unsigned)") SECTION("number (unsigned)")
...@@ -560,13 +560,13 @@ TEST_CASE("element access 2") ...@@ -560,13 +560,13 @@ TEST_CASE("element access 2")
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
CHECK_THROWS_WITH(j_nonobject["foo"], CHECK_THROWS_WITH(j_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_const_nonobject["foo"], CHECK_THROWS_WITH(j_const_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
} }
SECTION("number (floating-point)") SECTION("number (floating-point)")
...@@ -578,13 +578,13 @@ TEST_CASE("element access 2") ...@@ -578,13 +578,13 @@ TEST_CASE("element access 2")
CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&); CHECK_THROWS_AS(j_const_nonobject["foo"], json::type_error&);
CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&); CHECK_THROWS_AS(j_const_nonobject[json::object_t::key_type("foo")], json::type_error&);
CHECK_THROWS_WITH(j_nonobject["foo"], CHECK_THROWS_WITH(j_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_const_nonobject["foo"], CHECK_THROWS_WITH(j_const_nonobject["foo"],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")], CHECK_THROWS_WITH(j_const_nonobject[json::object_t::key_type("foo")],
"[json.exception.type_error.305] cannot use operator[] with number"); "[json.exception.type_error.305] cannot use operator[] with a key-style argument with number");
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment