mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-23 07:17:30 +02:00
Tests: add user-defined literal ""_s
for std::string
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
|
||||
#include <catch.hpp>
|
||||
|
||||
#include "Literals.hpp"
|
||||
|
||||
TEST_CASE("Issue #1120") {
|
||||
JsonDocument doc;
|
||||
constexpr char str[] =
|
||||
@ -10,12 +12,12 @@ TEST_CASE("Issue #1120") {
|
||||
|
||||
SECTION("MemberProxy<std::string>::isNull()") {
|
||||
SECTION("returns false") {
|
||||
auto value = doc[std::string("contents")];
|
||||
auto value = doc["contents"_s];
|
||||
CHECK(value.isNull() == false);
|
||||
}
|
||||
|
||||
SECTION("returns true") {
|
||||
auto value = doc[std::string("zontents")];
|
||||
auto value = doc["zontents"_s];
|
||||
CHECK(value.isNull() == true);
|
||||
}
|
||||
}
|
||||
@ -46,12 +48,12 @@ TEST_CASE("Issue #1120") {
|
||||
|
||||
SECTION("MemberProxy<ElementProxy<MemberProxy>, std::string>::isNull()") {
|
||||
SECTION("returns false") {
|
||||
auto value = doc["contents"][1][std::string("module")];
|
||||
auto value = doc["contents"][1]["module"_s];
|
||||
CHECK(value.isNull() == false);
|
||||
}
|
||||
|
||||
SECTION("returns true") {
|
||||
auto value = doc["contents"][1][std::string("zodule")];
|
||||
auto value = doc["contents"][1]["zodule"_s];
|
||||
CHECK(value.isNull() == true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user