From 3b796f4ec5b9b15cc0b4a1bb6cfd4bcb8117ca6b Mon Sep 17 00:00:00 2001 From: Jun Chen Date: Mon, 29 Nov 2021 12:57:07 -0500 Subject: [PATCH 1/5] Add case index to batcher match result --- expect.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/expect.go b/expect.go index 25df64f..53c1ba7 100644 --- a/expect.go +++ b/expect.go @@ -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]. @@ -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 } From a4d94fc68b7b471cf60676054f93f9bf7f385f0e Mon Sep 17 00:00:00 2001 From: Jun Chen Date: Mon, 29 Nov 2021 13:00:14 -0500 Subject: [PATCH 2/5] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 90cf987..d13d411 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/google/goexpect +module github.com/jun-rh/goexpect go 1.12 From 599ba0069c01992d14f61bec297bcf020149f25e Mon Sep 17 00:00:00 2001 From: Jun Chen Date: Mon, 29 Nov 2021 13:11:08 -0500 Subject: [PATCH 3/5] Update single regex case --- expect.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/expect.go b/expect.go index 53c1ba7..9e415fc 100644 --- a/expect.go +++ b/expect.go @@ -655,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 } From ba85dde9fe19f1bd8bc4d906824df315bb3d5777 Mon Sep 17 00:00:00 2001 From: Jun Chen Date: Mon, 29 Nov 2021 16:18:16 -0500 Subject: [PATCH 4/5] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d13d411..21f4e51 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/jun-rh/goexpect +module github.com/test-network-function/goexpect go 1.12 From aeda6e18d2452c4fcc44a2ec8bb620791f5b6c18 Mon Sep 17 00:00:00 2001 From: Jun Chen Date: Tue, 30 Nov 2021 15:48:33 -0500 Subject: [PATCH 5/5] Update module url for upstream --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 21f4e51..90cf987 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/test-network-function/goexpect +module github.com/google/goexpect go 1.12