@@ -348,23 +348,26 @@ func TestWrite(t *testing.T) {
348
348
writeAndCompare (`key=va'lu'e` , `key="va'lu'e"` )
349
349
// newlines, backslashes, and some other special chars are escaped
350
350
writeAndCompare (`foo="$ba\n\r\\r!"` , `foo="\$ba\n\r\\r\!"` )
351
+ // lines should be sorted
352
+ writeAndCompare ("foo=bar\n baz=buzz" , "baz=\" buzz\" \n foo=\" bar\" " )
353
+
351
354
}
352
355
353
356
func TestRoundtrip (t * testing.T ) {
354
- fixtures := []string {"equals.env" , "exported.env" , "invalid1.env" , " plain.env" , "quoted.env" }
357
+ fixtures := []string {"equals.env" , "exported.env" , "plain.env" , "quoted.env" }
355
358
for _ , fixture := range fixtures {
356
359
fixtureFilename := fmt .Sprintf ("fixtures/%s" , fixture )
357
360
env , err := readFile (fixtureFilename )
358
361
if err != nil {
359
- continue
362
+ t . Errorf ( "Expected '%s' to read without error (%v)" , fixtureFilename , err )
360
363
}
361
364
rep , err := Marshal (env )
362
365
if err != nil {
363
- continue
366
+ t . Errorf ( "Expected '%s' to Marshal (%v)" , fixtureFilename , err )
364
367
}
365
368
roundtripped , err := Unmarshal (rep )
366
369
if err != nil {
367
- continue
370
+ t . Errorf ( "Expected '%s' to Mashal and Unmarshal (%v)" , fixtureFilename , err )
368
371
}
369
372
if ! reflect .DeepEqual (env , roundtripped ) {
370
373
t .Errorf ("Expected '%s' to roundtrip as '%v', got '%v' instead" , fixtureFilename , env , roundtripped )
0 commit comments