Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions expect.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ func (t TimeoutError) Error() string {
type BatchRes struct {
// Idx is used to match the result with the []Batcher commands sent in.
Idx int
// CaseIdx indicates which case in the batcher matched
CaseIdx int
// Out output buffer for the expect command at Batcher[Idx].
Output string
// Match regexp matches for expect command at Batcher[Idx].
Expand Down Expand Up @@ -653,7 +655,7 @@ func (e *GExpect) ExpectBatch(batch []Batcher, timeout time.Duration) ([]BatchRe
to = timeout
}
out, match, err := e.Expect(re, to)
res = append(res, BatchRes{i, out, match})
res = append(res, BatchRes{i, 0, out, match})
if err != nil {
return res, err
}
Expand All @@ -666,8 +668,8 @@ func (e *GExpect) ExpectBatch(batch []Batcher, timeout time.Duration) ([]BatchRe
if to < 0 {
to = timeout
}
out, match, _, err := e.ExpectSwitchCase(b.Cases(), to)
res = append(res, BatchRes{i, out, match})
out, match, caseIdx, err := e.ExpectSwitchCase(b.Cases(), to)
res = append(res, BatchRes{i, caseIdx, out, match})
if err != nil {
return res, err
}
Expand Down