Skip to content

Commit 07dc0e1

Browse files
committed
Use test instead of name for test names
1 parent d8ec1ca commit 07dc0e1

File tree

12 files changed

+814
-814
lines changed

12 files changed

+814
-814
lines changed

parser/lex_test.go

Lines changed: 134 additions & 134 deletions
Large diffs are not rendered by default.

parser/parse_test.go

Lines changed: 186 additions & 186 deletions
Large diffs are not rendered by default.

path_test.go

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ func TestParseSpecExamples(t *testing.T) {
2626
books, _ := store["book"].([]any)
2727

2828
for _, tc := range []struct {
29-
name string
29+
test string
3030
path string
3131
exp NodeList
3232
loc LocatedNodeList
3333
size int
3434
rand bool
3535
}{
3636
{
37-
name: "example_1",
37+
test: "example_1",
3838
path: `$.store.book[*].author`,
3939
exp: NodeList{"Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"},
4040
loc: LocatedNodeList{
@@ -45,7 +45,7 @@ func TestParseSpecExamples(t *testing.T) {
4545
},
4646
},
4747
{
48-
name: "example_2",
48+
test: "example_2",
4949
path: `$..author`,
5050
exp: NodeList{"Nigel Rees", "Evelyn Waugh", "Herman Melville", "J. R. R. Tolkien"},
5151
loc: LocatedNodeList{
@@ -56,7 +56,7 @@ func TestParseSpecExamples(t *testing.T) {
5656
},
5757
},
5858
{
59-
name: "example_3",
59+
test: "example_3",
6060
path: `$.store.*`,
6161
exp: NodeList{store["book"], store["bicycle"]},
6262
loc: LocatedNodeList{
@@ -66,7 +66,7 @@ func TestParseSpecExamples(t *testing.T) {
6666
rand: true,
6767
},
6868
{
69-
name: "example_4",
69+
test: "example_4",
7070
path: `$.store..price`,
7171
exp: NodeList{399., 8.95, 12.99, 8.99, 22.99},
7272
loc: LocatedNodeList{
@@ -79,19 +79,19 @@ func TestParseSpecExamples(t *testing.T) {
7979
rand: true,
8080
},
8181
{
82-
name: "example_5",
82+
test: "example_5",
8383
path: `$..book[2]`,
8484
exp: NodeList{books[2]},
8585
loc: []*spec.LocatedNode{{Path: book(2), Node: books[2]}},
8686
},
8787
{
88-
name: "example_6",
88+
test: "example_6",
8989
path: `$..book[-1]`,
9090
exp: NodeList{books[3]},
9191
loc: []*spec.LocatedNode{{Path: book(3), Node: books[3]}},
9292
},
9393
{
94-
name: "example_7",
94+
test: "example_7",
9595
path: `$..book[0,1]`,
9696
exp: NodeList{books[0], books[1]},
9797
loc: LocatedNodeList{
@@ -100,7 +100,7 @@ func TestParseSpecExamples(t *testing.T) {
100100
},
101101
},
102102
{
103-
name: "example_8",
103+
test: "example_8",
104104
path: `$..book[?(@.isbn)]`,
105105
exp: NodeList{books[2], books[3]},
106106
loc: LocatedNodeList{
@@ -109,7 +109,7 @@ func TestParseSpecExamples(t *testing.T) {
109109
},
110110
},
111111
{
112-
name: "example_9",
112+
test: "example_9",
113113
path: `$..book[?(@.price<10)]`,
114114
exp: NodeList{books[0], books[2]},
115115
loc: LocatedNodeList{
@@ -118,13 +118,13 @@ func TestParseSpecExamples(t *testing.T) {
118118
},
119119
},
120120
{
121-
name: "example_10",
121+
test: "example_10",
122122
path: `$..*`,
123123
size: 27,
124124
rand: true,
125125
},
126126
} {
127-
t.Run(tc.name, func(t *testing.T) {
127+
t.Run(tc.test, func(t *testing.T) {
128128
t.Parallel()
129129
a := assert.New(t)
130130
r := require.New(t)
@@ -229,7 +229,7 @@ func TestParseCompliance(t *testing.T) {
229229

230230
//nolint:tagliatelle
231231
type testCase struct {
232-
Name string `json:"name"`
232+
Test string `json:"name"`
233233
Selector string `json:"selector"`
234234
Document any `json:"document"`
235235
Result NodeList `json:"result"`
@@ -256,7 +256,7 @@ func TestParseCompliance(t *testing.T) {
256256
a := assert.New(t)
257257
r := require.New(t)
258258

259-
description := fmt.Sprintf("%v: `%v`", tc.Name, tc.Selector)
259+
description := fmt.Sprintf("%v: `%v`", tc.Test, tc.Selector)
260260
p, err := p.Parse(tc.Selector)
261261
if tc.InvalidSelector {
262262
r.Error(err, description)
@@ -301,30 +301,30 @@ func TestParser(t *testing.T) {
301301
reg := registry.New()
302302

303303
for _, tc := range []struct {
304-
name string
304+
test string
305305
path string
306306
reg *registry.Registry
307307
exp *Path
308308
err string
309309
}{
310310
{
311-
name: "root",
311+
test: "root",
312312
path: "$",
313313
exp: MustParse("$"),
314314
},
315315
{
316-
name: "root_reg",
316+
test: "root_reg",
317317
path: "$",
318318
reg: reg,
319319
exp: MustParse("$"),
320320
},
321321
{
322-
name: "parse_error",
322+
test: "parse_error",
323323
path: "lol",
324324
err: "jsonpath: unexpected identifier at position 1",
325325
},
326326
} {
327-
t.Run(tc.name, func(t *testing.T) {
327+
t.Run(tc.test, func(t *testing.T) {
328328
t.Parallel()
329329
a := assert.New(t)
330330
r := require.New(t)
@@ -399,31 +399,31 @@ func TestNodeList(t *testing.T) {
399399
t.Parallel()
400400

401401
for _, tc := range []struct {
402-
name string
402+
test string
403403
list NodeList
404404
}{
405405
{
406-
name: "empty",
406+
test: "empty",
407407
list: NodeList{},
408408
},
409409
{
410-
name: "one_node",
410+
test: "one_node",
411411
list: NodeList{true},
412412
},
413413
{
414-
name: "two_nodes",
414+
test: "two_nodes",
415415
list: NodeList{true, "hi"},
416416
},
417417
{
418-
name: "dupe_nodes",
418+
test: "dupe_nodes",
419419
list: NodeList{"hi", "hi"},
420420
},
421421
{
422-
name: "many_nodes",
422+
test: "many_nodes",
423423
list: NodeList{"hi", true, nil, "hi", 42, 98.6, []any{99}, map[string]any{"hi": "go"}},
424424
},
425425
} {
426-
t.Run(tc.name, func(t *testing.T) {
426+
t.Run(tc.test, func(t *testing.T) {
427427
t.Parallel()
428428
a := assert.New(t)
429429

@@ -441,29 +441,29 @@ func TestLocatedNodeList(t *testing.T) {
441441
t.Parallel()
442442

443443
for _, tc := range []struct {
444-
name string
444+
test string
445445
list LocatedNodeList
446446
nodes []any
447447
paths []spec.NormalizedPath
448448
uniq LocatedNodeList
449449
sort LocatedNodeList
450450
}{
451451
{
452-
name: "empty",
452+
test: "empty",
453453
list: LocatedNodeList{},
454454
uniq: LocatedNodeList{},
455455
sort: LocatedNodeList{},
456456
},
457457
{
458-
name: "one_node",
458+
test: "one_node",
459459
list: LocatedNodeList{{Path: norm("foo"), Node: 42}},
460460
nodes: []any{42},
461461
paths: []spec.NormalizedPath{norm("foo")},
462462
uniq: LocatedNodeList{{Path: norm("foo"), Node: 42}},
463463
sort: LocatedNodeList{{Path: norm("foo"), Node: 42}},
464464
},
465465
{
466-
name: "two_names",
466+
test: "two_names",
467467
list: LocatedNodeList{
468468
{Path: norm("foo", "bar"), Node: true},
469469
},
@@ -477,7 +477,7 @@ func TestLocatedNodeList(t *testing.T) {
477477
},
478478
},
479479
{
480-
name: "two_nodes",
480+
test: "two_nodes",
481481
list: LocatedNodeList{
482482
{Path: norm("foo"), Node: 42},
483483
{Path: norm("bar"), Node: true},
@@ -495,7 +495,7 @@ func TestLocatedNodeList(t *testing.T) {
495495
},
496496
},
497497
{
498-
name: "three_nodes",
498+
test: "three_nodes",
499499
list: LocatedNodeList{
500500
{Path: norm("foo"), Node: 42},
501501
{Path: norm("bar"), Node: true},
@@ -516,7 +516,7 @@ func TestLocatedNodeList(t *testing.T) {
516516
},
517517
},
518518
{
519-
name: "two_nodes_diff_lengths",
519+
test: "two_nodes_diff_lengths",
520520
list: LocatedNodeList{
521521
{Path: norm("foo"), Node: 42},
522522
{Path: norm("bar", "baz"), Node: true},
@@ -534,7 +534,7 @@ func TestLocatedNodeList(t *testing.T) {
534534
},
535535
},
536536
{
537-
name: "two_nodes_diff_lengths_reverse",
537+
test: "two_nodes_diff_lengths_reverse",
538538
list: LocatedNodeList{
539539
{Path: norm("foo", "baz"), Node: 42},
540540
{Path: norm("bar"), Node: true},
@@ -552,7 +552,7 @@ func TestLocatedNodeList(t *testing.T) {
552552
},
553553
},
554554
{
555-
name: "dupe_nodes",
555+
test: "dupe_nodes",
556556
list: LocatedNodeList{
557557
{Path: norm("foo"), Node: 42},
558558
{Path: norm("bar"), Node: true},
@@ -571,7 +571,7 @@ func TestLocatedNodeList(t *testing.T) {
571571
},
572572
},
573573
} {
574-
t.Run(tc.name, func(t *testing.T) {
574+
t.Run(tc.test, func(t *testing.T) {
575575
t.Parallel()
576576
a := assert.New(t)
577577

0 commit comments

Comments
 (0)