ParserFile: Config format allows empty lines

- defined as: lines that consist only of whitespace
This commit is contained in:
Olle Jonsson 2016-03-19 17:12:30 +01:00
parent 068af037f5
commit 0fccc4396f
2 changed files with 3 additions and 3 deletions

View File

@ -52,7 +52,7 @@ module GitHubChangelogGenerator
# Returns true if the line starts with a pound sign or a semi-colon. # Returns true if the line starts with a pound sign or a semi-colon.
def non_configuration_line?(line) def non_configuration_line?(line)
line =~ /^[\#;]/ line =~ /^[\#;]/ || line =~ /^[\s]+$/
end end
# Returns a the option name as a symbol and its string value sans newlines. # Returns a the option name as a symbol and its string value sans newlines.

View File

@ -25,8 +25,8 @@ describe GitHubChangelogGenerator::ParserFile do
it { expect { parser.parse! }.to raise_error(/line #2/) } it { expect { parser.parse! }.to raise_error(/line #2/) }
end end
context "allows comments with semi-colon or pound sign" do context "allows empty lines and comments with semi-colon or pound sign" do
let(:file) { StringIO.new("# Comment on first line\nunreleased_label=staging\n; Comment on third line\nunreleased=false") } let(:file) { StringIO.new("\n \n# Comment on first line\nunreleased_label=staging\n; Comment on third line\nunreleased=false") }
let(:parser) do let(:parser) do
GitHubChangelogGenerator::ParserFile.new(options, file) GitHubChangelogGenerator::ParserFile.new(options, file)
end end