@@ -80,6 +80,7 @@ func TestReadPlainEnv(t *testing.T) {
8080 "OPTION_E" : "5" ,
8181 "OPTION_F" : "" ,
8282 "OPTION_G" : "" ,
83+ "OPTION_H" : "my string" ,
8384 }
8485
8586 envMap , err := Read (envFileName )
@@ -93,7 +94,7 @@ func TestReadPlainEnv(t *testing.T) {
9394
9495 for key , value := range expectedValues {
9596 if envMap [key ] != value {
96- t .Error ("Read got one of the keys wrong" )
97+ t .Errorf ("Read got one of the keys wrong. Expected: %q got %q" , value , envMap [ key ] )
9798 }
9899 }
99100}
@@ -350,7 +351,7 @@ func TestParsing(t *testing.T) {
350351 // parses yaml style options
351352 parseAndCompare (t , "OPTION_A: 1" , "OPTION_A" , "1" )
352353
353- //parses yaml values with equal signs
354+ // parses yaml values with equal signs
354355 parseAndCompare (t , "OPTION_A: Foo=bar" , "OPTION_A" , "Foo=bar" )
355356
356357 // parses non-yaml options with colons
@@ -399,7 +400,7 @@ func TestParsing(t *testing.T) {
399400 parseAndCompare (t , `FOO="ba#r"` , "FOO" , "ba#r" )
400401 parseAndCompare (t , "FOO='ba#r'" , "FOO" , "ba#r" )
401402
402- //newlines and backslashes should be escaped
403+ // newlines and backslashes should be escaped
403404 parseAndCompare (t , `FOO="bar\n\ b\az"` , "FOO" , "bar\n baz" )
404405 parseAndCompare (t , `FOO="bar\\\n\ b\az"` , "FOO" , "bar\\ \n baz" )
405406 parseAndCompare (t , `FOO="bar\\r\ b\az"` , "FOO" , "bar\\ r baz" )
@@ -483,14 +484,14 @@ func TestWrite(t *testing.T) {
483484 t .Errorf ("Expected '%v' (%v) to write as '%v', got '%v' instead." , env , envMap , expected , actual )
484485 }
485486 }
486- //just test some single lines to show the general idea
487- //TestRoundtrip makes most of the good assertions
487+ // just test some single lines to show the general idea
488+ // TestRoundtrip makes most of the good assertions
488489
489- //values are always double-quoted
490+ // values are always double-quoted
490491 writeAndCompare (`key=value` , `key="value"` )
491- //double-quotes are escaped
492+ // double-quotes are escaped
492493 writeAndCompare (`key=va"lu"e` , `key="va\"lu\"e"` )
493- //but single quotes are left alone
494+ // but single quotes are left alone
494495 writeAndCompare (`key=va'lu'e` , `key="va'lu'e"` )
495496 // newlines, backslashes, and some other special chars are escaped
496497 writeAndCompare (`foo="\n\r\\r!"` , `foo="\n\r\\r\!"` )
0 commit comments