delve/service/dap/daptest/resp.go
Hyang-Ah Hana Kim 4b4f7a589a
daptest/gen: autogenerate some assertion functions (#2441)
daptest has type assertion functions that panic
if the read response/event message is not
the expected type. This is not only against the
recommended style guideline (Don't Panic, Useful
Test Failures, ...), but also it prevents from
quickly diagnosing test failures occurred in remote
CIs.

This PR changes the type assertion to the two
return value type assertion, and t.Fatal with details
if the type is not expected.
service/dap/daptest/main.go is a program that auto
generates those assertion functions in resp.go.

Run `go generate` from the service/dap directory
to update resp.go.
2021-05-06 11:11:45 +02:00

719 lines
22 KiB
Go

package daptest
// Code generated by go generate; DO NOT EDIT.
// The code generator program is in ./gen directory.
import (
"testing"
"github.com/google/go-dap"
)
// ExpectAttachResponse reads a protocol message from the connection
// and fails the test if the read message is not *AttachResponse.
func (c *Client) ExpectAttachResponse(t *testing.T) *dap.AttachResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.AttachResponse)
if !ok {
t.Fatalf("got %q, want *dap.AttachResponse", m)
}
return r
}
// ExpectBreakpointEvent reads a protocol message from the connection
// and fails the test if the read message is not *BreakpointEvent.
func (c *Client) ExpectBreakpointEvent(t *testing.T) *dap.BreakpointEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.BreakpointEvent)
if !ok {
t.Fatalf("got %q, want *dap.BreakpointEvent", m)
}
return r
}
// ExpectBreakpointLocationsResponse reads a protocol message from the connection
// and fails the test if the read message is not *BreakpointLocationsResponse.
func (c *Client) ExpectBreakpointLocationsResponse(t *testing.T) *dap.BreakpointLocationsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.BreakpointLocationsResponse)
if !ok {
t.Fatalf("got %q, want *dap.BreakpointLocationsResponse", m)
}
return r
}
// ExpectCancelResponse reads a protocol message from the connection
// and fails the test if the read message is not *CancelResponse.
func (c *Client) ExpectCancelResponse(t *testing.T) *dap.CancelResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.CancelResponse)
if !ok {
t.Fatalf("got %q, want *dap.CancelResponse", m)
}
return r
}
// ExpectCapabilitiesEvent reads a protocol message from the connection
// and fails the test if the read message is not *CapabilitiesEvent.
func (c *Client) ExpectCapabilitiesEvent(t *testing.T) *dap.CapabilitiesEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.CapabilitiesEvent)
if !ok {
t.Fatalf("got %q, want *dap.CapabilitiesEvent", m)
}
return r
}
// ExpectCompletionsResponse reads a protocol message from the connection
// and fails the test if the read message is not *CompletionsResponse.
func (c *Client) ExpectCompletionsResponse(t *testing.T) *dap.CompletionsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.CompletionsResponse)
if !ok {
t.Fatalf("got %q, want *dap.CompletionsResponse", m)
}
return r
}
// ExpectConfigurationDoneResponse reads a protocol message from the connection
// and fails the test if the read message is not *ConfigurationDoneResponse.
func (c *Client) ExpectConfigurationDoneResponse(t *testing.T) *dap.ConfigurationDoneResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ConfigurationDoneResponse)
if !ok {
t.Fatalf("got %q, want *dap.ConfigurationDoneResponse", m)
}
return r
}
// ExpectContinueResponse reads a protocol message from the connection
// and fails the test if the read message is not *ContinueResponse.
func (c *Client) ExpectContinueResponse(t *testing.T) *dap.ContinueResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ContinueResponse)
if !ok {
t.Fatalf("got %q, want *dap.ContinueResponse", m)
}
return r
}
// ExpectContinuedEvent reads a protocol message from the connection
// and fails the test if the read message is not *ContinuedEvent.
func (c *Client) ExpectContinuedEvent(t *testing.T) *dap.ContinuedEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ContinuedEvent)
if !ok {
t.Fatalf("got %q, want *dap.ContinuedEvent", m)
}
return r
}
// ExpectDataBreakpointInfoResponse reads a protocol message from the connection
// and fails the test if the read message is not *DataBreakpointInfoResponse.
func (c *Client) ExpectDataBreakpointInfoResponse(t *testing.T) *dap.DataBreakpointInfoResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.DataBreakpointInfoResponse)
if !ok {
t.Fatalf("got %q, want *dap.DataBreakpointInfoResponse", m)
}
return r
}
// ExpectDisassembleResponse reads a protocol message from the connection
// and fails the test if the read message is not *DisassembleResponse.
func (c *Client) ExpectDisassembleResponse(t *testing.T) *dap.DisassembleResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.DisassembleResponse)
if !ok {
t.Fatalf("got %q, want *dap.DisassembleResponse", m)
}
return r
}
// ExpectDisconnectResponse reads a protocol message from the connection
// and fails the test if the read message is not *DisconnectResponse.
func (c *Client) ExpectDisconnectResponse(t *testing.T) *dap.DisconnectResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.DisconnectResponse)
if !ok {
t.Fatalf("got %q, want *dap.DisconnectResponse", m)
}
return r
}
// ExpectErrorResponse reads a protocol message from the connection
// and fails the test if the read message is not *ErrorResponse.
func (c *Client) ExpectErrorResponse(t *testing.T) *dap.ErrorResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ErrorResponse)
if !ok {
t.Fatalf("got %q, want *dap.ErrorResponse", m)
}
return r
}
// ExpectEvaluateResponse reads a protocol message from the connection
// and fails the test if the read message is not *EvaluateResponse.
func (c *Client) ExpectEvaluateResponse(t *testing.T) *dap.EvaluateResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.EvaluateResponse)
if !ok {
t.Fatalf("got %q, want *dap.EvaluateResponse", m)
}
return r
}
// ExpectExceptionInfoResponse reads a protocol message from the connection
// and fails the test if the read message is not *ExceptionInfoResponse.
func (c *Client) ExpectExceptionInfoResponse(t *testing.T) *dap.ExceptionInfoResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ExceptionInfoResponse)
if !ok {
t.Fatalf("got %q, want *dap.ExceptionInfoResponse", m)
}
return r
}
// ExpectExitedEvent reads a protocol message from the connection
// and fails the test if the read message is not *ExitedEvent.
func (c *Client) ExpectExitedEvent(t *testing.T) *dap.ExitedEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ExitedEvent)
if !ok {
t.Fatalf("got %q, want *dap.ExitedEvent", m)
}
return r
}
// ExpectGotoResponse reads a protocol message from the connection
// and fails the test if the read message is not *GotoResponse.
func (c *Client) ExpectGotoResponse(t *testing.T) *dap.GotoResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.GotoResponse)
if !ok {
t.Fatalf("got %q, want *dap.GotoResponse", m)
}
return r
}
// ExpectGotoTargetsResponse reads a protocol message from the connection
// and fails the test if the read message is not *GotoTargetsResponse.
func (c *Client) ExpectGotoTargetsResponse(t *testing.T) *dap.GotoTargetsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.GotoTargetsResponse)
if !ok {
t.Fatalf("got %q, want *dap.GotoTargetsResponse", m)
}
return r
}
// ExpectInitializeResponse reads a protocol message from the connection
// and fails the test if the read message is not *InitializeResponse.
func (c *Client) ExpectInitializeResponse(t *testing.T) *dap.InitializeResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.InitializeResponse)
if !ok {
t.Fatalf("got %q, want *dap.InitializeResponse", m)
}
return r
}
// ExpectInitializedEvent reads a protocol message from the connection
// and fails the test if the read message is not *InitializedEvent.
func (c *Client) ExpectInitializedEvent(t *testing.T) *dap.InitializedEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.InitializedEvent)
if !ok {
t.Fatalf("got %q, want *dap.InitializedEvent", m)
}
return r
}
// ExpectInvalidatedEvent reads a protocol message from the connection
// and fails the test if the read message is not *InvalidatedEvent.
func (c *Client) ExpectInvalidatedEvent(t *testing.T) *dap.InvalidatedEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.InvalidatedEvent)
if !ok {
t.Fatalf("got %q, want *dap.InvalidatedEvent", m)
}
return r
}
// ExpectLaunchResponse reads a protocol message from the connection
// and fails the test if the read message is not *LaunchResponse.
func (c *Client) ExpectLaunchResponse(t *testing.T) *dap.LaunchResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.LaunchResponse)
if !ok {
t.Fatalf("got %q, want *dap.LaunchResponse", m)
}
return r
}
// ExpectLoadedSourceEvent reads a protocol message from the connection
// and fails the test if the read message is not *LoadedSourceEvent.
func (c *Client) ExpectLoadedSourceEvent(t *testing.T) *dap.LoadedSourceEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.LoadedSourceEvent)
if !ok {
t.Fatalf("got %q, want *dap.LoadedSourceEvent", m)
}
return r
}
// ExpectLoadedSourcesResponse reads a protocol message from the connection
// and fails the test if the read message is not *LoadedSourcesResponse.
func (c *Client) ExpectLoadedSourcesResponse(t *testing.T) *dap.LoadedSourcesResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.LoadedSourcesResponse)
if !ok {
t.Fatalf("got %q, want *dap.LoadedSourcesResponse", m)
}
return r
}
// ExpectModuleEvent reads a protocol message from the connection
// and fails the test if the read message is not *ModuleEvent.
func (c *Client) ExpectModuleEvent(t *testing.T) *dap.ModuleEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ModuleEvent)
if !ok {
t.Fatalf("got %q, want *dap.ModuleEvent", m)
}
return r
}
// ExpectModulesResponse reads a protocol message from the connection
// and fails the test if the read message is not *ModulesResponse.
func (c *Client) ExpectModulesResponse(t *testing.T) *dap.ModulesResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ModulesResponse)
if !ok {
t.Fatalf("got %q, want *dap.ModulesResponse", m)
}
return r
}
// ExpectNextResponse reads a protocol message from the connection
// and fails the test if the read message is not *NextResponse.
func (c *Client) ExpectNextResponse(t *testing.T) *dap.NextResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.NextResponse)
if !ok {
t.Fatalf("got %q, want *dap.NextResponse", m)
}
return r
}
// ExpectOutputEvent reads a protocol message from the connection
// and fails the test if the read message is not *OutputEvent.
func (c *Client) ExpectOutputEvent(t *testing.T) *dap.OutputEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.OutputEvent)
if !ok {
t.Fatalf("got %q, want *dap.OutputEvent", m)
}
return r
}
// ExpectPauseResponse reads a protocol message from the connection
// and fails the test if the read message is not *PauseResponse.
func (c *Client) ExpectPauseResponse(t *testing.T) *dap.PauseResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.PauseResponse)
if !ok {
t.Fatalf("got %q, want *dap.PauseResponse", m)
}
return r
}
// ExpectProcessEvent reads a protocol message from the connection
// and fails the test if the read message is not *ProcessEvent.
func (c *Client) ExpectProcessEvent(t *testing.T) *dap.ProcessEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ProcessEvent)
if !ok {
t.Fatalf("got %q, want *dap.ProcessEvent", m)
}
return r
}
// ExpectProgressEndEvent reads a protocol message from the connection
// and fails the test if the read message is not *ProgressEndEvent.
func (c *Client) ExpectProgressEndEvent(t *testing.T) *dap.ProgressEndEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ProgressEndEvent)
if !ok {
t.Fatalf("got %q, want *dap.ProgressEndEvent", m)
}
return r
}
// ExpectProgressStartEvent reads a protocol message from the connection
// and fails the test if the read message is not *ProgressStartEvent.
func (c *Client) ExpectProgressStartEvent(t *testing.T) *dap.ProgressStartEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ProgressStartEvent)
if !ok {
t.Fatalf("got %q, want *dap.ProgressStartEvent", m)
}
return r
}
// ExpectProgressUpdateEvent reads a protocol message from the connection
// and fails the test if the read message is not *ProgressUpdateEvent.
func (c *Client) ExpectProgressUpdateEvent(t *testing.T) *dap.ProgressUpdateEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ProgressUpdateEvent)
if !ok {
t.Fatalf("got %q, want *dap.ProgressUpdateEvent", m)
}
return r
}
// ExpectReadMemoryResponse reads a protocol message from the connection
// and fails the test if the read message is not *ReadMemoryResponse.
func (c *Client) ExpectReadMemoryResponse(t *testing.T) *dap.ReadMemoryResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ReadMemoryResponse)
if !ok {
t.Fatalf("got %q, want *dap.ReadMemoryResponse", m)
}
return r
}
// ExpectRestartFrameResponse reads a protocol message from the connection
// and fails the test if the read message is not *RestartFrameResponse.
func (c *Client) ExpectRestartFrameResponse(t *testing.T) *dap.RestartFrameResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.RestartFrameResponse)
if !ok {
t.Fatalf("got %q, want *dap.RestartFrameResponse", m)
}
return r
}
// ExpectRestartResponse reads a protocol message from the connection
// and fails the test if the read message is not *RestartResponse.
func (c *Client) ExpectRestartResponse(t *testing.T) *dap.RestartResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.RestartResponse)
if !ok {
t.Fatalf("got %q, want *dap.RestartResponse", m)
}
return r
}
// ExpectReverseContinueResponse reads a protocol message from the connection
// and fails the test if the read message is not *ReverseContinueResponse.
func (c *Client) ExpectReverseContinueResponse(t *testing.T) *dap.ReverseContinueResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ReverseContinueResponse)
if !ok {
t.Fatalf("got %q, want *dap.ReverseContinueResponse", m)
}
return r
}
// ExpectRunInTerminalResponse reads a protocol message from the connection
// and fails the test if the read message is not *RunInTerminalResponse.
func (c *Client) ExpectRunInTerminalResponse(t *testing.T) *dap.RunInTerminalResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.RunInTerminalResponse)
if !ok {
t.Fatalf("got %q, want *dap.RunInTerminalResponse", m)
}
return r
}
// ExpectScopesResponse reads a protocol message from the connection
// and fails the test if the read message is not *ScopesResponse.
func (c *Client) ExpectScopesResponse(t *testing.T) *dap.ScopesResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ScopesResponse)
if !ok {
t.Fatalf("got %q, want *dap.ScopesResponse", m)
}
return r
}
// ExpectSetBreakpointsResponse reads a protocol message from the connection
// and fails the test if the read message is not *SetBreakpointsResponse.
func (c *Client) ExpectSetBreakpointsResponse(t *testing.T) *dap.SetBreakpointsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SetBreakpointsResponse)
if !ok {
t.Fatalf("got %q, want *dap.SetBreakpointsResponse", m)
}
return r
}
// ExpectSetDataBreakpointsResponse reads a protocol message from the connection
// and fails the test if the read message is not *SetDataBreakpointsResponse.
func (c *Client) ExpectSetDataBreakpointsResponse(t *testing.T) *dap.SetDataBreakpointsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SetDataBreakpointsResponse)
if !ok {
t.Fatalf("got %q, want *dap.SetDataBreakpointsResponse", m)
}
return r
}
// ExpectSetExceptionBreakpointsResponse reads a protocol message from the connection
// and fails the test if the read message is not *SetExceptionBreakpointsResponse.
func (c *Client) ExpectSetExceptionBreakpointsResponse(t *testing.T) *dap.SetExceptionBreakpointsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SetExceptionBreakpointsResponse)
if !ok {
t.Fatalf("got %q, want *dap.SetExceptionBreakpointsResponse", m)
}
return r
}
// ExpectSetExpressionResponse reads a protocol message from the connection
// and fails the test if the read message is not *SetExpressionResponse.
func (c *Client) ExpectSetExpressionResponse(t *testing.T) *dap.SetExpressionResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SetExpressionResponse)
if !ok {
t.Fatalf("got %q, want *dap.SetExpressionResponse", m)
}
return r
}
// ExpectSetFunctionBreakpointsResponse reads a protocol message from the connection
// and fails the test if the read message is not *SetFunctionBreakpointsResponse.
func (c *Client) ExpectSetFunctionBreakpointsResponse(t *testing.T) *dap.SetFunctionBreakpointsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SetFunctionBreakpointsResponse)
if !ok {
t.Fatalf("got %q, want *dap.SetFunctionBreakpointsResponse", m)
}
return r
}
// ExpectSetInstructionBreakpointsResponse reads a protocol message from the connection
// and fails the test if the read message is not *SetInstructionBreakpointsResponse.
func (c *Client) ExpectSetInstructionBreakpointsResponse(t *testing.T) *dap.SetInstructionBreakpointsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SetInstructionBreakpointsResponse)
if !ok {
t.Fatalf("got %q, want *dap.SetInstructionBreakpointsResponse", m)
}
return r
}
// ExpectSetVariableResponse reads a protocol message from the connection
// and fails the test if the read message is not *SetVariableResponse.
func (c *Client) ExpectSetVariableResponse(t *testing.T) *dap.SetVariableResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SetVariableResponse)
if !ok {
t.Fatalf("got %q, want *dap.SetVariableResponse", m)
}
return r
}
// ExpectSourceResponse reads a protocol message from the connection
// and fails the test if the read message is not *SourceResponse.
func (c *Client) ExpectSourceResponse(t *testing.T) *dap.SourceResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.SourceResponse)
if !ok {
t.Fatalf("got %q, want *dap.SourceResponse", m)
}
return r
}
// ExpectStackTraceResponse reads a protocol message from the connection
// and fails the test if the read message is not *StackTraceResponse.
func (c *Client) ExpectStackTraceResponse(t *testing.T) *dap.StackTraceResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.StackTraceResponse)
if !ok {
t.Fatalf("got %q, want *dap.StackTraceResponse", m)
}
return r
}
// ExpectStepBackResponse reads a protocol message from the connection
// and fails the test if the read message is not *StepBackResponse.
func (c *Client) ExpectStepBackResponse(t *testing.T) *dap.StepBackResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.StepBackResponse)
if !ok {
t.Fatalf("got %q, want *dap.StepBackResponse", m)
}
return r
}
// ExpectStepInResponse reads a protocol message from the connection
// and fails the test if the read message is not *StepInResponse.
func (c *Client) ExpectStepInResponse(t *testing.T) *dap.StepInResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.StepInResponse)
if !ok {
t.Fatalf("got %q, want *dap.StepInResponse", m)
}
return r
}
// ExpectStepInTargetsResponse reads a protocol message from the connection
// and fails the test if the read message is not *StepInTargetsResponse.
func (c *Client) ExpectStepInTargetsResponse(t *testing.T) *dap.StepInTargetsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.StepInTargetsResponse)
if !ok {
t.Fatalf("got %q, want *dap.StepInTargetsResponse", m)
}
return r
}
// ExpectStepOutResponse reads a protocol message from the connection
// and fails the test if the read message is not *StepOutResponse.
func (c *Client) ExpectStepOutResponse(t *testing.T) *dap.StepOutResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.StepOutResponse)
if !ok {
t.Fatalf("got %q, want *dap.StepOutResponse", m)
}
return r
}
// ExpectStoppedEvent reads a protocol message from the connection
// and fails the test if the read message is not *StoppedEvent.
func (c *Client) ExpectStoppedEvent(t *testing.T) *dap.StoppedEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.StoppedEvent)
if !ok {
t.Fatalf("got %q, want *dap.StoppedEvent", m)
}
return r
}
// ExpectTerminateResponse reads a protocol message from the connection
// and fails the test if the read message is not *TerminateResponse.
func (c *Client) ExpectTerminateResponse(t *testing.T) *dap.TerminateResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.TerminateResponse)
if !ok {
t.Fatalf("got %q, want *dap.TerminateResponse", m)
}
return r
}
// ExpectTerminateThreadsResponse reads a protocol message from the connection
// and fails the test if the read message is not *TerminateThreadsResponse.
func (c *Client) ExpectTerminateThreadsResponse(t *testing.T) *dap.TerminateThreadsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.TerminateThreadsResponse)
if !ok {
t.Fatalf("got %q, want *dap.TerminateThreadsResponse", m)
}
return r
}
// ExpectTerminatedEvent reads a protocol message from the connection
// and fails the test if the read message is not *TerminatedEvent.
func (c *Client) ExpectTerminatedEvent(t *testing.T) *dap.TerminatedEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.TerminatedEvent)
if !ok {
t.Fatalf("got %q, want *dap.TerminatedEvent", m)
}
return r
}
// ExpectThreadEvent reads a protocol message from the connection
// and fails the test if the read message is not *ThreadEvent.
func (c *Client) ExpectThreadEvent(t *testing.T) *dap.ThreadEvent {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ThreadEvent)
if !ok {
t.Fatalf("got %q, want *dap.ThreadEvent", m)
}
return r
}
// ExpectThreadsResponse reads a protocol message from the connection
// and fails the test if the read message is not *ThreadsResponse.
func (c *Client) ExpectThreadsResponse(t *testing.T) *dap.ThreadsResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.ThreadsResponse)
if !ok {
t.Fatalf("got %q, want *dap.ThreadsResponse", m)
}
return r
}
// ExpectVariablesResponse reads a protocol message from the connection
// and fails the test if the read message is not *VariablesResponse.
func (c *Client) ExpectVariablesResponse(t *testing.T) *dap.VariablesResponse {
t.Helper()
m := c.ExpectMessage(t)
r, ok := m.(*dap.VariablesResponse)
if !ok {
t.Fatalf("got %q, want *dap.VariablesResponse", m)
}
return r
}