Skip to content

Fix library parse error if there is an extra blank line in library_properties.rb #224

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

Closed
wants to merge 5 commits into from
Closed
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed

### Fixed
- Parse error in `library_properties.rb`
- Missing include of `IPAddress.h` in `Client.h`

### Security

Expand Down
7 changes: 7 additions & 0 deletions SampleProjects/NetworkLib/test/client.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <ArduinoUnitTests.h>
// test for including <Client.h> without <Arduino.h>
#include <Client.h>

unittest(test) { assertTrue(true); }

unittest_main()
3 changes: 2 additions & 1 deletion SampleProjects/TestSomething/library.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ version=0.1.0
author=Ian Katz <[email protected]>
maintainer=Ian Katz <[email protected]>
sentence=Arduino CI unit test example
paragraph=A skeleton library demonstrating CI and unit tests
paragraph=A skeleton library demonstrating CI and unit tests. NOTE THAT THE EXTRA BLANK LINE AT THE END OF THIS FILE IS INTENTIONAL TO TEST A PARSE ERROR (#224)!
category=Other
url=https://github.com/Arduino-CI/arduino_ci/SampleProjects/TestSomething
architectures=avr,esp8266
includes=test-something.h

1 change: 1 addition & 0 deletions cpp/arduino/Client.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <Stream.h>
#include <IPAddress.h>

class Client : public Stream {
public:
Expand Down
2 changes: 1 addition & 1 deletion lib/arduino_ci/library_properties.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class LibraryProperties
def initialize(path)
@fields = {}
File.foreach(path) do |line|
parts = line.split("=", 2)
parts = line.strip.split("=", 2) # check for empty on next line fails if there is a newline (#224)
@fields[parts[0]] = parts[1].chomp unless parts.empty?
end
end
Expand Down