aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2018-01-16 22:42:41 +0800
committerGitHub <noreply@github.com>2018-01-16 22:42:41 +0800
commitf08cd94fb755471cb78091af99ef7026afb392f3 (patch)
treedbcb5f01698b4fe13d5b79ab369056fcfefada90 /internal
parent216e584899ed522088419438c9c605a20b5dc9ae (diff)
downloaddexon-f08cd94fb755471cb78091af99ef7026afb392f3.tar.gz
dexon-f08cd94fb755471cb78091af99ef7026afb392f3.tar.zst
dexon-f08cd94fb755471cb78091af99ef7026afb392f3.zip
cmd/ethkey: fix formatting, review nits (#15807)
This commit: - Adds a --msgfile option to read the message to sign from a file instead of command line argument. - Adds a unit test for signing subcommands. - Removes some weird whitespace in the code.
Diffstat (limited to 'internal')
-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)