Fix concurrent access to PropertyValue in TestPropertyPath
@@ -9,7 +9,8 @@ import (
func TestPropertyPath(t *testing.T) {
t.Parallel()
- value := NewObjectProperty(NewPropertyMapFromMap(map[string]interface{}{
+ makeValue := func() PropertyValue {
+ return NewObjectProperty(NewPropertyMapFromMap(map[string]interface{}{
"root": map[string]interface{}{
"nested": map[string]interface{}{
"array": []interface{}{
@@ -49,6 +50,7 @@ func TestPropertyPath(t *testing.T) {
true,
},
}))
+ }
cases := []struct {
path string
@@ -142,6 +144,8 @@ func TestPropertyPath(t *testing.T) {
assert.Equal(t, c.parsed, parsed)
assert.Equal(t, c.expected, parsed.String())
+ value := makeValue()
+
v, ok := parsed.Get(value)
assert.True(t, ok)
assert.False(t, v.IsNull())
@@ -226,6 +230,8 @@ func TestPropertyPath(t *testing.T) {
parsed, err := ParsePropertyPath(c)
if err == nil {
+ value := makeValue()
+
v, ok := parsed.Get(value)
assert.False(t, ok)
assert.True(t, v.IsNull())
