TestCallInterruptHandler_DirectCall directly tests callInterruptHandler method for 100% coverage
(t *testing.T)
| 406 | |
| 407 | // TestCallInterruptHandler_DirectCall directly tests callInterruptHandler method for 100% coverage |
| 408 | func TestCallInterruptHandler_DirectCall(t *testing.T) { |
| 409 | rt := NewRuntime() |
| 410 | defer rt.Close() |
| 411 | |
| 412 | // Test return 0 branch when no handler is set |
| 413 | rt.ClearInterruptHandler() |
| 414 | require.Equal(t, 0, rt.callInterruptHandler()) |
| 415 | |
| 416 | // Test handler invocation with different return values |
| 417 | testCases := []int{0, 1, 42, -1} |
| 418 | for _, expected := range testCases { |
| 419 | rt.SetInterruptHandler(func() int { return expected }) |
| 420 | require.Equal(t, expected, rt.callInterruptHandler()) |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | // TestRuntimeTimeoutVsInterruptHandler tests precedence between timeout and interrupt handler |
| 425 | func TestRuntimeTimeoutVsInterruptHandler(t *testing.T) { |
nothing calls this directly
no test coverage detected