From 48ca995c3b153da4e059302fa49b4c0b193f1ed9 Mon Sep 17 00:00:00 2001 From: "John Barton (joho)" Date: Wed, 31 Jul 2013 12:28:41 +1000 Subject: [PATCH] Add some more tests. --- godotenv_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/godotenv_test.go b/godotenv_test.go index 24f6748..47acbc2 100644 --- a/godotenv_test.go +++ b/godotenv_test.go @@ -98,9 +98,16 @@ func TestParsing(t *testing.T) { // it 'parses # in quoted values' do // expect(env('foo="ba#r"')).to eql('foo' => 'ba#r') // expect(env("foo='ba#r'")).to eql('foo' => 'ba#r') + parseAndCompare(t, "FOO=\"ba#r\"", "FOO", "ba#r") + parseAndCompare(t, "FOO='ba#r'", "FOO", "ba#r") // it 'throws an error if line format is incorrect' do // expect{env('lol$wut')}.to raise_error(Dotenv::FormatError) + badlyFormattedLine := "lol$wut" + _, _, err := parseLine(badlyFormattedLine) + if err == nil { + t.Errorf("Expected \"%v\" to return error, but it didn't", badlyFormattedLine) + } // it 'ignores empty lines' do // expect(env("\n \t \nfoo=bar\n \nfizz=buzz")).to eql('foo' => 'bar', 'fizz' => 'buzz')