Skip to content

Stream::readStreamUntil() should not return delimiter #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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).
Expand Down
12 changes: 12 additions & 0 deletions SampleProjects/TestSomething/test/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = &micros;
// result should not include delimiter
assertEqual("abc", s.readStringUntil(':'));
assertEqual("def", s.readStringUntil(':'));
}
unittest_main()
2 changes: 1 addition & 1 deletion cpp/arduino/Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down