@@ -60,7 +60,6 @@ func TestParser(t *testing.T) {
6060
6161 // array with errors
6262 "[,]" : {want : "[]" , errors : true },
63- "[ 1, 5, ]" : {want : "[1,5]" },
6463 "[ 1, 2, ]" : {options : & ParseOptions {TrailingCommas : false }, want : "[1,2]" , errors : true },
6564 "[ 1 2, 3]" : {want : "[1,2,3]" , errors : true },
6665 "[ ,1, 2, 3 ]" : {want : "[1,2,3]" , errors : true },
@@ -76,8 +75,10 @@ func TestParser(t *testing.T) {
7675 `{ "hello": [] }` : {want : `{"hello":[]}` },
7776 `{ "hello": [], "world": {}, }` : {want : `{"hello":[],"world":{}}` },
7877 `{ "hello2": [], "world": {} }` : {want : `{"hello2":[],"world":{}}` },
78+ "[ 1, 5, ]" : {want : "[1,5]" },
7979 `{ "hello2": [], }` : {options : & ParseOptions {TrailingCommas : false }, want : `{"hello2":[]}` , errors : true },
8080 `{ "hello2": [], "world": {}, }` : {options : & ParseOptions {TrailingCommas : false }, want : `{"hello2":[],"world":{}}` , errors : true },
81+ "[ 1, 6, ]" : {options : & ParseOptions {TrailingCommas : false }, want : "[1,6]" , errors : true },
8182 }
8283 for input , test := range tests {
8384 label := fmt .Sprintf ("%q" , input )
@@ -93,6 +94,9 @@ func TestParser(t *testing.T) {
9394 if test .errors && errors == nil {
9495 t .Errorf ("%s: got no parse errors, want parse errors" , label )
9596 }
97+ if ! test .errors && errors != nil {
98+ t .Errorf ("%s: got parse errors %v, want no parse errors" , label , errors )
99+ }
96100 if string (output ) != test .want {
97101 t .Errorf ("%s: got output %s, want %s" , label , output , test .want )
98102 }
0 commit comments