github.com/sagernet/sing@v0.4.0-beta.19.0.20240518125136-f67a0988a636/common/winpowrprof/event_test.go (about) 1 package winpowrprof 2 3 import ( 4 "runtime" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 ) 9 10 func TestPowerEvents(t *testing.T) { 11 if runtime.GOOS != "windows" { 12 t.SkipNow() 13 } 14 listener, err := NewEventListener(func(event int) {}) 15 require.NoError(t, err) 16 require.NotNil(t, listener) 17 require.NoError(t, listener.Start()) 18 require.NoError(t, listener.Close()) 19 }