mirror of
https://github.com/eledio-devices/thirdparty-ArduinoJson.git
synced 2025-11-01 08:48:30 +01:00
Fixed ambiguous overload with JsonArraySubscript and JsonObjectSubscript (issue #122)
This commit is contained in:
30
test/JsonObject_Remove_Tests.cpp
Normal file
30
test/JsonObject_Remove_Tests.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright Benoit Blanchon 2014-2015
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#define TEST_(name) TEST(JsonObject_Remove_Tests, name)
|
||||
|
||||
TEST_(SizeDecreased_WhenValuesAreRemoved) {
|
||||
DynamicJsonBuffer _jsonBuffer;
|
||||
JsonObject& _object = _jsonBuffer.createObject();
|
||||
_object["hello"] = 1;
|
||||
|
||||
_object.remove("hello");
|
||||
|
||||
EXPECT_EQ(0, _object.size());
|
||||
}
|
||||
|
||||
TEST_(SizeUntouched_WhenRemoveIsCalledWithAWrongKey) {
|
||||
DynamicJsonBuffer _jsonBuffer;
|
||||
JsonObject& _object = _jsonBuffer.createObject();
|
||||
_object["hello"] = 1;
|
||||
|
||||
_object.remove("world");
|
||||
|
||||
EXPECT_EQ(1, _object.size());
|
||||
}
|
||||
Reference in New Issue
Block a user