Replace "key-style argument" with "string argument"

This commit is contained in:
Ben Berman 2018-09-17 15:36:38 -04:00
parent ad053ef09c
commit 8f07ab6392
3 changed files with 34 additions and 34 deletions

View file

@ -3173,7 +3173,7 @@ class basic_json
return m_value.object->operator[](key); return m_value.object->operator[](key);
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!
@ -3215,7 +3215,7 @@ class basic_json
return m_value.object->find(key)->second; return m_value.object->find(key)->second;
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!
@ -3262,7 +3262,7 @@ class basic_json
return m_value.object->operator[](key); return m_value.object->operator[](key);
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!
@ -3305,7 +3305,7 @@ class basic_json
return m_value.object->find(key)->second; return m_value.object->find(key)->second;
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!

View file

@ -14280,7 +14280,7 @@ class basic_json
return m_value.object->operator[](key); return m_value.object->operator[](key);
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!
@ -14322,7 +14322,7 @@ class basic_json
return m_value.object->find(key)->second; return m_value.object->find(key)->second;
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!
@ -14369,7 +14369,7 @@ class basic_json
return m_value.object->operator[](key); return m_value.object->operator[](key);
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!
@ -14412,7 +14412,7 @@ class basic_json
return m_value.object->find(key)->second; return m_value.object->find(key)->second;
} }
JSON_THROW(type_error::create(305, "cannot use operator[] with a key-style argument with " + std::string(type_name()))); JSON_THROW(type_error::create(305, "cannot use operator[] with a string argument with " + std::string(type_name())));
} }
/*! /*!

View file

@ -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 a key-style argument with null"); CHECK_THROWS_WITH(j_const_nonobject["foo"], "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with null"); "[json.exception.type_error.305] cannot use operator[] with a string argument with null");
} }
SECTION("boolean") SECTION("boolean")
@ -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 a key-style argument with boolean"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with boolean"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with boolean"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with boolean"); "[json.exception.type_error.305] cannot use operator[] with a string argument with boolean");
} }
SECTION("string") SECTION("string")
@ -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 a key-style argument with string"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with string"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with string"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with string"); "[json.exception.type_error.305] cannot use operator[] with a string argument with string");
} }
SECTION("array") SECTION("array")
@ -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 a key-style argument with array"); "[json.exception.type_error.305] cannot use operator[] with a string argument 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_nonobject[json::object_t::key_type("foo")], "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with array"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with array"); "[json.exception.type_error.305] cannot use operator[] with a string argument with array");
} }
SECTION("number (integer)") SECTION("number (integer)")
@ -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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string argument with number");
} }
SECTION("number (unsigned)") SECTION("number (unsigned)")
@ -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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string argument with number");
} }
SECTION("number (floating-point)") SECTION("number (floating-point)")
@ -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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string 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 a key-style argument with number"); "[json.exception.type_error.305] cannot use operator[] with a string argument with number");
} }
} }
} }