@@ -79,6 +79,7 @@ func TestReadPlainEnv(t *testing.T) {
7979 "OPTION_E" : "5" ,
8080 "OPTION_F" : "" ,
8181 "OPTION_G" : "" ,
82+ "OPTION_H" : "my string" ,
8283 }
8384
8485 envMap , err := Read (envFileName )
@@ -92,7 +93,7 @@ func TestReadPlainEnv(t *testing.T) {
9293
9394 for key , value := range expectedValues {
9495 if envMap [key ] != value {
95- t .Error ("Read got one of the keys wrong" )
96+ t .Errorf ("Read got one of the keys wrong. Expected: %q got %q" , value , envMap [ key ] )
9697 }
9798 }
9899}
@@ -349,7 +350,7 @@ func TestParsing(t *testing.T) {
349350 // parses yaml style options
350351 parseAndCompare (t , "OPTION_A: 1" , "OPTION_A" , "1" )
351352
352- //parses yaml values with equal signs
353+ // parses yaml values with equal signs
353354 parseAndCompare (t , "OPTION_A: Foo=bar" , "OPTION_A" , "Foo=bar" )
354355
355356 // parses non-yaml options with colons
@@ -398,7 +399,7 @@ func TestParsing(t *testing.T) {
398399 parseAndCompare (t , `FOO="ba#r"` , "FOO" , "ba#r" )
399400 parseAndCompare (t , "FOO='ba#r'" , "FOO" , "ba#r" )
400401
401- //newlines and backslashes should be escaped
402+ // newlines and backslashes should be escaped
402403 parseAndCompare (t , `FOO="bar\n\ b\az"` , "FOO" , "bar\n baz" )
403404 parseAndCompare (t , `FOO="bar\\\n\ b\az"` , "FOO" , "bar\\ \n baz" )
404405 parseAndCompare (t , `FOO="bar\\r\ b\az"` , "FOO" , "bar\\ r baz" )
@@ -482,14 +483,14 @@ func TestWrite(t *testing.T) {
482483 t .Errorf ("Expected '%v' (%v) to write as '%v', got '%v' instead." , env , envMap , expected , actual )
483484 }
484485 }
485- //just test some single lines to show the general idea
486- //TestRoundtrip makes most of the good assertions
486+ // just test some single lines to show the general idea
487+ // TestRoundtrip makes most of the good assertions
487488
488- //values are always double-quoted
489+ // values are always double-quoted
489490 writeAndCompare (`key=value` , `key="value"` )
490- //double-quotes are escaped
491+ // double-quotes are escaped
491492 writeAndCompare (`key=va"lu"e` , `key="va\"lu\"e"` )
492- //but single quotes are left alone
493+ // but single quotes are left alone
493494 writeAndCompare (`key=va'lu'e` , `key="va'lu'e"` )
494495 // newlines, backslashes, and some other special chars are escaped
495496 writeAndCompare (`foo="\n\r\\r!"` , `foo="\n\r\\r\!"` )
0 commit comments