File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -73,3 +73,33 @@ func TestParsePath(t *testing.T) {
7373 })
7474 }
7575}
76+
77+ func TestWithProperty (t * testing.T ) {
78+ rootPath := Path {}.WithProperty ("foo" ).WithProperty ("bar" ).WithProperty ("aaaa" )
79+
80+ path1 := rootPath .WithProperty ("baz1" )
81+ path2 := rootPath .WithProperty ("baz2" )
82+
83+ if path1 .String () != "foo.bar.aaaa.baz1" {
84+ t .Errorf ("path1.String() = %v, expected %v" , path1 .String (), "foo.bar.aaaa.baz1" )
85+ }
86+
87+ if path2 .String () != "foo.bar.aaaa.baz2" {
88+ t .Errorf ("path2.String() = %v, expected %v" , path2 .String (), "foo.bar.aaaa.baz2" )
89+ }
90+ }
91+
92+ func TestWithIndex (t * testing.T ) {
93+ rootPath := Path {}.WithProperty ("foo" ).WithProperty ("bar" ).WithProperty ("aaaa" )
94+
95+ path1 := rootPath .WithIndex (0 )
96+ path2 := rootPath .WithIndex (1 )
97+
98+ if path1 .String () != "foo.bar.aaaa[0]" {
99+ t .Errorf ("path1.String() = %v, expected %v" , path1 .String (), "foo.bar.aaaa[0]" )
100+ }
101+
102+ if path2 .String () != "foo.bar.aaaa[1]" {
103+ t .Errorf ("path2.String() = %v, expected %v" , path2 .String (), "foo.bar.aaaa[1]" )
104+ }
105+ }
You can’t perform that action at this time.
0 commit comments