aboutsummaryrefslogtreecommitdiffstats
path: root/internal/cmdtest
diff options
context:
space:
mode:
authorJanos Guljas <janos@resenje.org>2018-02-09 19:23:30 +0800
committerJanos Guljas <janos@resenje.org>2018-02-22 21:23:17 +0800
commita3a07350dcef0ba39829a20d8ddba4bd3463d293 (patch)
tree100f2515cadd92105537a12e6981fab2193435ee /internal/cmdtest
parent820cf09c98706f71d4b02b6c25e62db15830f3fb (diff)
parent1a4e68721a901e86322631fed1191025a6d14c52 (diff)
downloadgo-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar
go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar.gz
go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar.bz2
go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar.lz
go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar.xz
go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.tar.zst
go-tangerine-a3a07350dcef0ba39829a20d8ddba4bd3463d293.zip
swarm, cmd/swarm: Merge branch 'master' into multiple-ens-endpoints
Diffstat (limited to 'internal/cmdtest')
-rw-r--r--internal/cmdtest/test_cmd.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/internal/cmdtest/test_cmd.go b/internal/cmdtest/test_cmd.go
index 541e51c4c..fae61cfe3 100644
--- a/internal/cmdtest/test_cmd.go
+++ b/internal/cmdtest/test_cmd.go
@@ -25,6 +25,7 @@ import (
"os"
"os/exec"
"regexp"
+ "strings"
"sync"
"testing"
"text/template"
@@ -141,9 +142,10 @@ func (tt *TestCmd) matchExactOutput(want []byte) error {
// Note that an arbitrary amount of output may be consumed by the
// regular expression. This usually means that expect cannot be used
// after ExpectRegexp.
-func (tt *TestCmd) ExpectRegexp(resource string) (*regexp.Regexp, []string) {
+func (tt *TestCmd) ExpectRegexp(regex string) (*regexp.Regexp, []string) {
+ regex = strings.TrimPrefix(regex, "\n")
var (
- re = regexp.MustCompile(resource)
+ re = regexp.MustCompile(regex)
rtee = &runeTee{in: tt.stdout}
matches []int
)
@@ -151,7 +153,7 @@ func (tt *TestCmd) ExpectRegexp(resource string) (*regexp.Regexp, []string) {
output := rtee.buf.Bytes()
if matches == nil {
tt.Fatalf("Output did not match:\n---------------- (stdout text)\n%s\n---------------- (regular expression)\n%s",
- output, resource)
+ output, regex)
return re, nil
}
tt.Logf("Matched stdout text:\n%s", output)