Red, green, rinse repeat.

pull/1/head
John Barton (joho) 2013-07-31 12:10:31 +10:00
parent 98b43188a1
commit aa6e870b57
2 changed files with 2 additions and 1 deletions

View File

@ -83,7 +83,7 @@ func parseLine(line string) (key string, value string, err error) {
segmentsBetweenHashes := strings.Split(value, "#")
value = segmentsBetweenHashes[0]
// open quote in leftmost segment
if strings.Count(value, "\"") == 1 {
if strings.Count(value, "\"") == 1 || strings.Count(value, "'") == 1 {
value = value + "#" + segmentsBetweenHashes[1]
}
}

View File

@ -89,6 +89,7 @@ func TestParsing(t *testing.T) {
// it 'allows # in quoted value' do
// expect(env('foo="bar#baz" # comment')).to eql('foo' => 'bar#baz')
parseAndCompare(t, "FOO=\"bar#baz\" # comment", "FOO", "bar#baz")
parseAndCompare(t, "FOO='bar#baz' # comment", "FOO", "bar#baz")
// it 'ignores comment lines' do
// expect(env("\n\n\n # HERE GOES FOO \nfoo=bar")).to eql('foo' => 'bar')