Skip to content

Commit

Permalink
Merge pull request #300 from marco-m/readable-path-test
Browse files Browse the repository at this point in the history
Add field names to make test cases easier to understand
  • Loading branch information
goccy committed Jun 6, 2022
2 parents a353932 + c5e63d0 commit 883a73b
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions path_test.go
Expand Up @@ -281,19 +281,19 @@ func TestPath_Merge(t *testing.T) {
expected string
}{
{
"$.c",
`
path: "$.c",
dst: `
a: 1
b: 2
c:
d: 3
e: 4
`,
`
src: `
f: 5
g: 6
`,
`
expected: `
a: 1
b: 2
c:
Expand All @@ -304,20 +304,20 @@ c:
`,
},
{
"$.a.b",
`
path: "$.a.b",
dst: `
a:
b:
- 1
- 2
`,
`
src: `
- 3
- map:
- 4
- 5
`,
`
expected: `
a:
b:
- 1
Expand Down Expand Up @@ -397,30 +397,30 @@ func TestPath_Replace(t *testing.T) {
expected string
}{
{
"$.a",
`
path: "$.a",
dst: `
a: 1
b: 2
`,
`3`,
`
src: `3`,
expected: `
a: 3
b: 2
`,
},
{
"$.b",
`
path: "$.b",
dst: `
b: 1
c: 2
`,
`
src: `
d: e
f:
g: h
i: j
`,
`
expected: `
b:
d: e
f:
Expand All @@ -430,15 +430,15 @@ c: 2
`,
},
{
"$.a.b[0]",
`
path: "$.a.b[0]",
dst: `
a:
b:
- hello
c: 2
`,
`world`,
`
src: `world`,
expected: `
a:
b:
- world
Expand All @@ -447,8 +447,8 @@ c: 2
},

{
"$.books[*].author",
`
path: "$.books[*].author",
dst: `
books:
- name: book_a
author: none
Expand All @@ -462,8 +462,8 @@ pictures:
building:
author: none
`,
`ken`,
`
src: `ken`,
expected: `
books:
- name: book_a
author: ken
Expand All @@ -479,8 +479,8 @@ building:
`,
},
{
"$..author",
`
path: "$..author",
dst: `
books:
- name: book_a
author: none
Expand All @@ -494,8 +494,8 @@ pictures:
building:
author: none
`,
`ken`,
`
src: `ken`,
expected: `
books:
- name: book_a
author: ken
Expand Down

0 comments on commit 883a73b

Please sign in to comment.