removed path changes

This commit is contained in:
Andrew Nester 2024-10-11 14:56:01 +02:00
parent d4a334696e
commit 82d6640170
No known key found for this signature in database
GPG Key ID: 12BC628A44B7DA57
2 changed files with 1 additions and 8 deletions

View File

@ -91,11 +91,8 @@ func (p Path) HasPrefix(q Path) bool {
// String returns a string representation of the path. // String returns a string representation of the path.
func (p Path) String() string { func (p Path) String() string {
if len(p) == 0 {
return "."
}
var buf bytes.Buffer var buf bytes.Buffer
for i, c := range p { for i, c := range p {
if i > 0 && c.key != "" { if i > 0 && c.key != "" {
buf.WriteRune('.') buf.WriteRune('.')

View File

@ -72,7 +72,3 @@ func TestPathString(t *testing.T) {
p3 := dyn.NewPath(dyn.Key("foo"), dyn.Index(1), dyn.Key("bar"), dyn.Index(2), dyn.Key("baz")) p3 := dyn.NewPath(dyn.Key("foo"), dyn.Index(1), dyn.Key("bar"), dyn.Index(2), dyn.Key("baz"))
assert.Equal(t, "foo[1].bar[2].baz", p3.String()) assert.Equal(t, "foo[1].bar[2].baz", p3.String())
} }
func TestPathStringEmpty(t *testing.T) {
assert.Equal(t, ".", dyn.EmptyPath.String())
}