Skip to content

Commit 233f8da

Browse files
author
James Foster
authored
Merge pull request #302 from jgfoster/readStringUntil
Stream::readStreamUntil() should not return delimiter
2 parents ba9c12b + 96d9291 commit 233f8da

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3232

3333
### Changed
3434
- 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.
35+
- Stream::readStreamUntil() no longer returns delimiter
3536

3637
### Removed
3738
- scanning of `library.properties`; this can and should now be performed by the standalone [`arduino-lint` tool](https://arduino.github.io/arduino-lint).

SampleProjects/TestSomething/test/stream.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,16 @@ unittest(stream_parse)
6969

7070
}
7171

72+
unittest(readStringUntil) {
73+
String data = "";
74+
unsigned long micros = 100;
75+
data = "abc:def";
76+
77+
Stream s;
78+
s.mGodmodeDataIn = &data;
79+
s.mGodmodeMicrosDelay = &micros;
80+
// result should not include delimiter
81+
assertEqual("abc", s.readStringUntil(':'));
82+
assertEqual("def", s.readStringUntil(':'));
83+
}
7284
unittest_main()

cpp/arduino/Stream.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class Stream : public Print
186186
ret = String(*mGodmodeDataIn);
187187
mGodmodeDataIn->clear();
188188
} else {
189-
ret = mGodmodeDataIn->substring(0, idxTrm + 1);
189+
ret = mGodmodeDataIn->substring(0, idxTrm);
190190
fastforward(idxTrm + 1);
191191
}
192192
return ret;

0 commit comments

Comments
 (0)