aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/geth/run_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-04-02 00:10:58 +0800
committerFelix Lange <fjl@twurst.com>2016-04-12 21:59:18 +0800
commit91aaddaeb38ff25118896fb436a938d14636760b (patch)
tree4cdf271558b1038a83426c4489988fc4a6954851 /cmd/geth/run_test.go
parentea005a02950513603b7346ef39bc76dc53b82863 (diff)
downloadgo-tangerine-91aaddaeb38ff25118896fb436a938d14636760b.tar
go-tangerine-91aaddaeb38ff25118896fb436a938d14636760b.tar.gz
go-tangerine-91aaddaeb38ff25118896fb436a938d14636760b.tar.bz2
go-tangerine-91aaddaeb38ff25118896fb436a938d14636760b.tar.lz
go-tangerine-91aaddaeb38ff25118896fb436a938d14636760b.tar.xz
go-tangerine-91aaddaeb38ff25118896fb436a938d14636760b.tar.zst
go-tangerine-91aaddaeb38ff25118896fb436a938d14636760b.zip
cmd/geth: add recovery procedure for AmbiguousAddrError
Diffstat (limited to 'cmd/geth/run_test.go')
-rw-r--r--cmd/geth/run_test.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/cmd/geth/run_test.go b/cmd/geth/run_test.go
index a15d0bf28..a82eb9d68 100644
--- a/cmd/geth/run_test.go
+++ b/cmd/geth/run_test.go
@@ -45,6 +45,7 @@ type testgeth struct {
// template variables for expect
Datadir string
Executable string
+ Func template.FuncMap
removeDatadir bool
cmd *exec.Cmd
@@ -114,6 +115,13 @@ func (tt *testgeth) InputLine(s string) string {
return ""
}
+func (tt *testgeth) setTemplateFunc(name string, fn interface{}) {
+ if tt.Func == nil {
+ tt.Func = make(map[string]interface{})
+ }
+ tt.Func[name] = fn
+}
+
// expect runs its argument as a template, then expects the
// child process to output the result of the template within 5s.
//
@@ -121,7 +129,7 @@ func (tt *testgeth) InputLine(s string) string {
// before matching.
func (tt *testgeth) expect(tplsource string) {
// Generate the expected output by running the template.
- tpl := template.Must(template.New("").Parse(tplsource))
+ tpl := template.Must(template.New("").Funcs(tt.Func).Parse(tplsource))
wantbuf := new(bytes.Buffer)
if err := tpl.Execute(wantbuf, tt); err != nil {
panic(err)