Skip to content

Commit

Permalink
add test for path builder without method chainging
Browse files Browse the repository at this point in the history
  • Loading branch information
tobb10001 committed Jan 15, 2024
1 parent 0640a15 commit ba40289
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ func TestPathBuilder(t *testing.T) {
}
}

func TestPathBuilderNoChain(t *testing.T) {
builder := yaml.PathBuilder{}
builder.Root()
builder.Child("a")
builder.Child("b")
builder.Index(0)
path := builder.Build()

expected := `$.a.b[0]`
got := path.String()

if expected != got {
t.Fatalf("failed to build path. expected:[%q] but got:[%q]", expected, got)
}
}

func TestPath(t *testing.T) {
yml := `
store:
Expand Down

0 comments on commit ba40289

Please sign in to comment.