forked from bblanchon/ArduinoJson
Templatized all functions using String
or std::string
* Removed `ArduinoJson::String` * Removed `JsonVariant::defaultValue<T>()` * Removed non-template `JsonObject::get()` and `JsonArray.get()` * Fixed support for `StringSumHelper` (issue #184) * Replaced `ARDUINOJSON_USE_ARDUINO_STRING` by `ARDUINOJSON_ENABLE_STD_STRING` and `ARDUINOJSON_ENABLE_ARDUINO_STRING` (issue #378) * Added example `StringExample.ino` to show where `String` can be used
This commit is contained in:
26
test/JsonObject_Get_Tests.cpp
Normal file
26
test/JsonObject_Get_Tests.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class JsonObject_Get_Tests : public ::testing::Test {
|
||||
public:
|
||||
JsonObject_Get_Tests() : _object(_jsonBuffer.createObject()) {}
|
||||
|
||||
protected:
|
||||
DynamicJsonBuffer _jsonBuffer;
|
||||
JsonObject& _object;
|
||||
};
|
||||
|
||||
#define TEST_(name) TEST_F(JsonObject_Get_Tests, name)
|
||||
|
||||
TEST_(GetConstCharPointer_GivenStringLiteral) {
|
||||
_object.set("hello", "world");
|
||||
const char* value = _object.get<const char*>("hello");
|
||||
EXPECT_STREQ("world", value);
|
||||
}
|
Reference in New Issue
Block a user