From e67d2e92981f2ce08c45a5861a2c7c0cbda27472 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 3 Jun 2021 17:30:58 -0700 Subject: [PATCH 1/2] Stream::readStreamUntil() should not return delimiter. --- SampleProjects/TestSomething/test/stream.cpp | 12 ++++++++++++ cpp/arduino/Stream.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/SampleProjects/TestSomething/test/stream.cpp b/SampleProjects/TestSomething/test/stream.cpp index 78f0a0fa..dd218d97 100644 --- a/SampleProjects/TestSomething/test/stream.cpp +++ b/SampleProjects/TestSomething/test/stream.cpp @@ -69,4 +69,16 @@ unittest(stream_parse) } +unittest(readStringUntil) { + String data = ""; + unsigned long micros = 100; + data = "abc:def"; + + Stream s; + s.mGodmodeDataIn = &data; + s.mGodmodeMicrosDelay = µs; + // result should not include delimiter + assertEqual("abc", s.readStringUntil(':')); + assertEqual("def", s.readStringUntil(':')); +} unittest_main() diff --git a/cpp/arduino/Stream.h b/cpp/arduino/Stream.h index 9f766cbf..ef572095 100644 --- a/cpp/arduino/Stream.h +++ b/cpp/arduino/Stream.h @@ -186,7 +186,7 @@ class Stream : public Print ret = String(*mGodmodeDataIn); mGodmodeDataIn->clear(); } else { - ret = mGodmodeDataIn->substring(0, idxTrm + 1); + ret = mGodmodeDataIn->substring(0, idxTrm); fastforward(idxTrm + 1); } return ret; From a12369b02fb4240e9caac75225fb68914d7c6109 Mon Sep 17 00:00:00 2001 From: James Foster Date: Thu, 3 Jun 2021 17:36:01 -0700 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f29be1a6..0cb09b05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Changed - Topmost installtion instructions now suggest `gem install arduino_ci` instead of using a `Gemfile`. Reasons for using a `Gemfile` are listed and discussed separately further down the README. +- Stream::readStreamUntil() no longer returns delimiter ### Removed - scanning of `library.properties`; this can and should now be performed by the standalone [`arduino-lint` tool](https://arduino.github.io/arduino-lint).