@@ -1420,9 +1420,9 @@ func TestArrayEachWithWhiteSpace(t *testing.T) {
14201420 keys []string
14211421 }
14221422 tests := []struct {
1423- name string
1424- args args
1425- wantErr bool
1423+ name string
1424+ args args
1425+ wantErr bool
14261426 }{
14271427 {"Array with white space" , args {[]byte (` ["AAA", "BBB", "CCC"]` ), funcSuccess , []string {}}, false },
14281428 {"Array with only one character after white space" , args {[]byte (` 1` ), funcError , []string {}}, true },
@@ -1675,8 +1675,9 @@ func TestEachKey(t *testing.T) {
16751675 {"arrInt" , "[3]" },
16761676 {"arrInt" , "[5]" }, // Should not find last key
16771677 {"nested" },
1678- {"arr" , "[" }, // issue#177 Invalid arguments
1679- {"a\n " , "b\n " }, // issue#165
1678+ {"arr" , "[" }, // issue#177 Invalid arguments
1679+ {"a\n " , "b\n " }, // issue#165
1680+ {"nested" , "b" }, // Should find repeated key
16801681 }
16811682
16821683 keysFound := 0
@@ -1729,13 +1730,17 @@ func TestEachKey(t *testing.T) {
17291730 if string (value ) != "99" {
17301731 t .Error ("Should find 10 key" , string (value ))
17311732 }
1733+ case 12 :
1734+ if string (value ) != "2" {
1735+ t .Errorf ("Should find 11 key" )
1736+ }
17321737 default :
17331738 t .Errorf ("Should find only 10 keys, got %v key" , idx )
17341739 }
17351740 }, paths ... )
17361741
1737- if keysFound != 10 {
1738- t .Errorf ("Should find 10 keys: %d" , keysFound )
1742+ if keysFound != 11 {
1743+ t .Errorf ("Should find 11 keys: %d" , keysFound )
17391744 }
17401745}
17411746
0 commit comments