diff --git a/.travis.yml b/.travis.yml index 15bbf91e..e047b29f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,11 +97,19 @@ matrix: - compiler: gcc env: SCRIPT=coverage - os: osx - osx_image: xcode6.4 + osx_image: xcode7.3 compiler: clang env: SCRIPT=cmake - os: osx - osx_image: xcode7.3 + osx_image: xcode8.3 + compiler: clang + env: SCRIPT=cmake + - os: osx + osx_image: xcode9.4 + compiler: clang + env: SCRIPT=cmake + - os: osx + osx_image: xcode10 compiler: clang env: SCRIPT=cmake SANITIZE=address - env: SCRIPT=arduino VERSION=1.6.7 BOARD=arduino:avr:uno diff --git a/CHANGELOG.md b/CHANGELOG.md index 22aa4889..bdcb93cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ HEAD * Fixed object keys not being duplicated * `JsonPair::key()` now returns a `JsonKey` * Increased the default capacity of `DynamicJsonDocument` +* Fixed `JsonVariant::is()` (closes #763) v6.4.0-beta (2018-09-11) ----------- @@ -87,6 +88,7 @@ v6.2.0-beta (2018-07-12) ----------- * Disabled lazy number deserialization (issue #772) +* Fixed `JsonVariant::is()` that returned true for empty strings * Improved float serialization when `-fsingle-precision-constant` is used * Renamed function `RawJson()` to `serialized()` * `serializeMsgPack()` now supports values marked with `serialized()` diff --git a/appveyor.yml b/appveyor.yml index 572f2c55..e9de7010 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 6.0.1.{build} +version: 6.4.0.{build} environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 diff --git a/src/ArduinoJson/JsonVariant.hpp b/src/ArduinoJson/JsonVariant.hpp index 45e035b0..1c4e2792 100644 --- a/src/ArduinoJson/JsonVariant.hpp +++ b/src/ArduinoJson/JsonVariant.hpp @@ -305,9 +305,13 @@ class JsonVariant : public JsonVariantBase { // // bool is() const; // bool is() const; + // bool is() const; + // bool is() const; template - FORCE_INLINE typename enable_if< - is_same::value || is_same::value, bool>::type + FORCE_INLINE typename enable_if::value || + is_same::value || + IsWriteableString::value, + bool>::type is() const { return _data && (_data->type == JSON_LINKED_STRING || _data->type == JSON_OWNED_STRING); diff --git a/test/JsonVariant/is.cpp b/test/JsonVariant/is.cpp index 2f8e6c2b..c9f0097b 100644 --- a/test/JsonVariant/is.cpp +++ b/test/JsonVariant/is.cpp @@ -79,6 +79,7 @@ void checkIsString(const char *value) { var.set(value); REQUIRE(var.is()); + REQUIRE(var.is()); REQUIRE_FALSE(var.is()); REQUIRE_FALSE(var.is());