Skip to content
This repository has been archived by the owner on Jun 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from jun-rh/master
Browse files Browse the repository at this point in the history
Add case index to batcher result
  • Loading branch information
jc-rh authored Nov 30, 2021
2 parents ab937bf + ba85dde commit 82b3d7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/google/goexpect
module github.com/test-network-function/goexpect

go 1.12

Expand Down

0 comments on commit 82b3d7f

Please sign in to comment.