@@ -38,15 +38,15 @@ type coderTestdataEntry struct {
38
38
outIndented string // outCompacted if empty; uses " " for indent prefix and "\t" for indent
39
39
outCanonicalized string // outCompacted if empty
40
40
tokens []Token
41
- pointers []string
41
+ pointers []Pointer
42
42
}
43
43
44
44
var coderTestdata = []coderTestdataEntry {{
45
45
name : jsontest .Name ("Null" ),
46
46
in : ` null ` ,
47
47
outCompacted : `null` ,
48
48
tokens : []Token {Null },
49
- pointers : []string {"" },
49
+ pointers : []Pointer {"" },
50
50
}, {
51
51
name : jsontest .Name ("False" ),
52
52
in : ` false ` ,
@@ -157,15 +157,15 @@ var coderTestdata = []coderTestdataEntry{{
157
157
Int (minInt64 ), Int (maxInt64 ), Uint (minUint64 ), Uint (maxUint64 ),
158
158
ArrayEnd ,
159
159
},
160
- pointers : []string {
160
+ pointers : []Pointer {
161
161
"" , "/0" , "/1" , "/2" , "/3" , "/4" , "/5" , "/6" , "/7" , "/8" , "/9" , "/10" , "/11" , "/12" , "/13" , "/14" , "/15" , "/16" , "/17" , "" ,
162
162
},
163
163
}, {
164
164
name : jsontest .Name ("ObjectN0" ),
165
165
in : ` { } ` ,
166
166
outCompacted : `{}` ,
167
167
tokens : []Token {ObjectStart , ObjectEnd },
168
- pointers : []string {"" , "" },
168
+ pointers : []Pointer {"" , "" },
169
169
}, {
170
170
name : jsontest .Name ("ObjectN1" ),
171
171
in : ` { "0" : 0 } ` ,
@@ -175,7 +175,7 @@ var coderTestdata = []coderTestdataEntry{{
175
175
"0": 0
176
176
}` ,
177
177
tokens : []Token {ObjectStart , String ("0" ), Uint (0 ), ObjectEnd },
178
- pointers : []string {"" , "/0" , "/0" , "" },
178
+ pointers : []Pointer {"" , "/0" , "/0" , "" },
179
179
}, {
180
180
name : jsontest .Name ("ObjectN2" ),
181
181
in : ` { "0" : 0 , "1" : 1 } ` ,
@@ -186,7 +186,7 @@ var coderTestdata = []coderTestdataEntry{{
186
186
"1": 1
187
187
}` ,
188
188
tokens : []Token {ObjectStart , String ("0" ), Uint (0 ), String ("1" ), Uint (1 ), ObjectEnd },
189
- pointers : []string {"" , "/0" , "/0" , "/1" , "/1" , "" },
189
+ pointers : []Pointer {"" , "/0" , "/0" , "/1" , "/1" , "" },
190
190
}, {
191
191
name : jsontest .Name ("ObjectNested" ),
192
192
in : ` { "0" : { "1" : { "2" : { "3" : { "4" : { } } } } } } ` ,
@@ -204,7 +204,7 @@ var coderTestdata = []coderTestdataEntry{{
204
204
}
205
205
}` ,
206
206
tokens : []Token {ObjectStart , String ("0" ), ObjectStart , String ("1" ), ObjectStart , String ("2" ), ObjectStart , String ("3" ), ObjectStart , String ("4" ), ObjectStart , ObjectEnd , ObjectEnd , ObjectEnd , ObjectEnd , ObjectEnd , ObjectEnd },
207
- pointers : []string {
207
+ pointers : []Pointer {
208
208
"" ,
209
209
"/0" , "/0" ,
210
210
"/0/1" , "/0/1" ,
@@ -268,7 +268,7 @@ var coderTestdata = []coderTestdataEntry{{
268
268
ObjectEnd ,
269
269
ObjectEnd ,
270
270
},
271
- pointers : []string {
271
+ pointers : []Pointer {
272
272
"" ,
273
273
"/" , "/" ,
274
274
"//44444" , "//44444" ,
@@ -289,7 +289,7 @@ var coderTestdata = []coderTestdataEntry{{
289
289
in : ` [ ] ` ,
290
290
outCompacted : `[]` ,
291
291
tokens : []Token {ArrayStart , ArrayEnd },
292
- pointers : []string {"" , "" },
292
+ pointers : []Pointer {"" , "" },
293
293
}, {
294
294
name : jsontest .Name ("ArrayN1" ),
295
295
in : ` [ 0 ] ` ,
@@ -298,7 +298,7 @@ var coderTestdata = []coderTestdataEntry{{
298
298
0
299
299
]` ,
300
300
tokens : []Token {ArrayStart , Uint (0 ), ArrayEnd },
301
- pointers : []string {"" , "/0" , "" },
301
+ pointers : []Pointer {"" , "/0" , "" },
302
302
}, {
303
303
name : jsontest .Name ("ArrayN2" ),
304
304
in : ` [ 0 , 1 ] ` ,
@@ -322,7 +322,7 @@ var coderTestdata = []coderTestdataEntry{{
322
322
]
323
323
]` ,
324
324
tokens : []Token {ArrayStart , ArrayStart , ArrayStart , ArrayStart , ArrayStart , ArrayEnd , ArrayEnd , ArrayEnd , ArrayEnd , ArrayEnd },
325
- pointers : []string {
325
+ pointers : []Pointer {
326
326
"" ,
327
327
"/0" ,
328
328
"/0/0" ,
@@ -388,7 +388,7 @@ var coderTestdata = []coderTestdataEntry{{
388
388
String ("objectN2" ), ObjectStart , String ("0" ), Uint (0 ), String ("1" ), Uint (1 ), ObjectEnd ,
389
389
ObjectEnd ,
390
390
},
391
- pointers : []string {
391
+ pointers : []Pointer {
392
392
"" ,
393
393
"/literals" , "/literals" ,
394
394
"/literals/0" ,
@@ -494,8 +494,8 @@ func testCoderInterleaved(t *testing.T, where jsontest.CasePos, modeName string,
494
494
func TestCoderStackPointer (t * testing.T ) {
495
495
tests := []struct {
496
496
token Token
497
- wantWithRejectDuplicateNames string
498
- wantWithAllowDuplicateNames string
497
+ wantWithRejectDuplicateNames Pointer
498
+ wantWithAllowDuplicateNames Pointer
499
499
}{
500
500
{Null , "" , "" },
501
501
@@ -549,14 +549,14 @@ func TestCoderStackPointer(t *testing.T) {
549
549
550
550
for _ , allowDupes := range []bool {false , true } {
551
551
var name string
552
- var want func (i int ) string
552
+ var want func (i int ) Pointer
553
553
switch allowDupes {
554
554
case false :
555
555
name = "RejectDuplicateNames"
556
- want = func (i int ) string { return tests [i ].wantWithRejectDuplicateNames }
556
+ want = func (i int ) Pointer { return tests [i ].wantWithRejectDuplicateNames }
557
557
case true :
558
558
name = "AllowDuplicateNames"
559
- want = func (i int ) string { return tests [i ].wantWithAllowDuplicateNames }
559
+ want = func (i int ) Pointer { return tests [i ].wantWithAllowDuplicateNames }
560
560
}
561
561
562
562
t .Run (name , func (t * testing.T ) {
0 commit comments