MCPcopy Create free account
hub / github.com/cogentcore/core / TestProperties

Function TestProperties

tree/node_test.go:295–313  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

293}
294
295func TestProperties(t *testing.T) {
296 n := testdata.NewNodeEmbed()
297
298 n.SetProperty("intprop", 42)
299 assert.Equal(t, 42, n.Property("intprop"))
300
301 n.SetProperty("floatprop", 42.0)
302 assert.Equal(t, 42.0, n.Property("floatprop"))
303
304 n.SetProperty("stringprop", "test string")
305 assert.Equal(t, "test string", n.Property("stringprop"))
306
307 n.DeleteProperty("floatprop")
308 assert.Equal(t, nil, n.Property("floatprop"))
309
310 assert.Equal(t, nil, n.Property("randomprop"))
311
312 assert.Equal(t, map[string]any{"intprop": 42, "stringprop": "test string"}, n.Properties)
313}
314
315func TestPropertiesJSON(t *testing.T) {
316 testProperties := map[string]any{

Callers

nothing calls this directly

Calls 5

NewNodeEmbedFunction · 0.92
SetPropertyMethod · 0.80
EqualMethod · 0.80
PropertyMethod · 0.80
DeletePropertyMethod · 0.80

Tested by

no test coverage detected