You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For instance, given the following step definition:
func (s*Steps) ThenTheReturnedErrorsShouldBe(errorsTbl*godog.Table) error {
actualResponse:= []*struct {
CodeintDescriptionstring
}{
{Code: 123, Description: "Only one error"}, // <-- Only one element here
}
iferr:=assitdog.NewDefault().CompareToSlice(actualResponse, errorsTbl); err!=nil {
returnfmt.Errorf("return errors are different from expected: %v", err)
}
returnnil
}
And the following step in a scenario:
Then the returned errors should be
| Code | Description | | 123 | Firsterror | | 456 | Seconderror |
I would expect to see an error stating that the number of elements is different. However, I got a panic like the following:
panic: reflect: slice index out of range
goroutine 100 [running]:
testing.tRunner.func1.1(0x15b0220, 0x1727ba0)
/usr/local/Cellar/go/1.15.5/libexec/src/testing/testing.go:1072 +0x30d
testing.tRunner.func1(0xc000316a80)
/usr/local/Cellar/go/1.15.5/libexec/src/testing/testing.go:1075 +0x41a
panic(0x15b0220, 0x1727ba0)
/usr/local/Cellar/go/1.15.5/libexec/src/runtime/panic.go:969 +0x1b9
reflect.Value.Index(0x15a4da0, 0xc000153e00, 0x97, 0x1, 0x1a8bfe0, 0x0, 0x0)
/usr/local/Cellar/go/1.15.5/libexec/src/reflect/value.go:962 +0x1f2
github.com/rdumont/assistdog.(*Assist).CompareToSlice(0xc0003054a0, 0x15a4da0, 0xc000153e00, 0xc00031c7a0, 0x0, 0x0)
/Users/rodrigodumont/go/pkg/mod/github.com/rdumont/[email protected]/assist.go:212 +0x197
The text was updated successfully, but these errors were encountered:
For instance, given the following step definition:
And the following step in a scenario:
I would expect to see an error stating that the number of elements is different. However, I got a panic like the following:
The text was updated successfully, but these errors were encountered: