forked from coop-cloud-mirrors/godotenv
Red, green, rinse repeat.
This commit is contained in:
parent
98b43188a1
commit
aa6e870b57
@ -83,7 +83,7 @@ func parseLine(line string) (key string, value string, err error) {
|
|||||||
segmentsBetweenHashes := strings.Split(value, "#")
|
segmentsBetweenHashes := strings.Split(value, "#")
|
||||||
value = segmentsBetweenHashes[0]
|
value = segmentsBetweenHashes[0]
|
||||||
// open quote in leftmost segment
|
// open quote in leftmost segment
|
||||||
if strings.Count(value, "\"") == 1 {
|
if strings.Count(value, "\"") == 1 || strings.Count(value, "'") == 1 {
|
||||||
value = value + "#" + segmentsBetweenHashes[1]
|
value = value + "#" + segmentsBetweenHashes[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +89,7 @@ func TestParsing(t *testing.T) {
|
|||||||
// it 'allows # in quoted value' do
|
// it 'allows # in quoted value' do
|
||||||
// expect(env('foo="bar#baz" # comment')).to eql('foo' => 'bar#baz')
|
// 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")
|
||||||
|
parseAndCompare(t, "FOO='bar#baz' # comment", "FOO", "bar#baz")
|
||||||
|
|
||||||
// it 'ignores comment lines' do
|
// it 'ignores comment lines' do
|
||||||
// expect(env("\n\n\n # HERE GOES FOO \nfoo=bar")).to eql('foo' => 'bar')
|
// expect(env("\n\n\n # HERE GOES FOO \nfoo=bar")).to eql('foo' => 'bar')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user