(t *testing.T)
| 65 | } |
| 66 | |
| 67 | func TestContextWatcherMultipleWatchPanics(t *testing.T) { |
| 68 | cw := ctxwatch.NewContextWatcher(&testHandler{handleCancel: func(context.Context) {}, handleUnwatchAfterCancel: func() {}}) |
| 69 | |
| 70 | ctx, cancel := context.WithCancel(t.Context()) |
| 71 | defer cancel() |
| 72 | cw.Watch(ctx) |
| 73 | defer cw.Unwatch() |
| 74 | |
| 75 | ctx2, cancel2 := context.WithCancel(t.Context()) |
| 76 | defer cancel2() |
| 77 | require.Panics(t, func() { cw.Watch(ctx2) }, "Expected panic when Watch called multiple times") |
| 78 | } |
| 79 | |
| 80 | func TestContextWatcherUnwatchWhenNotWatchingIsSafe(t *testing.T) { |
| 81 | cw := ctxwatch.NewContextWatcher(&testHandler{handleCancel: func(context.Context) {}, handleUnwatchAfterCancel: func() {}}) |
nothing calls this directly
no test coverage detected