github.com/livekit/protocol@v1.39.3/utils/configutil/atomic_test.go (about) 1 package configutil 2 3 import ( 4 "testing" 5 6 "github.com/livekit/protocol/utils/events" 7 ) 8 9 type testConfig struct { 10 events.ObserverList[*testConfig] 11 } 12 13 func (c *testConfig) Observe(cb func(*testConfig)) func() { 14 return c.On(cb) 15 } 16 17 func (c *testConfig) Load() *testConfig { 18 return c 19 } 20 21 func TestInterfaceAtomicValue(t *testing.T) { 22 config := &testConfig{} 23 _ = NewAtomicValue(config, func(*testConfig) any { 24 return 1 25 }) 26 config.Emit(&testConfig{}) 27 }