cmdtest

package
v0.0.0-...-f8b7a73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TestCmd

type TestCmd struct {
	//为方便起见,所有测试方法都可用。
	*testing.T

	Func    template.FuncMap
	Data    interface{}
	Cleanup func()

	//错误将包含进程退出错误或中断信号错误
	Err error
	// contains filtered or unexported fields
}

func NewTestCmd

func NewTestCmd(t *testing.T, data interface{}) *TestCmd

func (*TestCmd) CloseStdin

func (tt *TestCmd) CloseStdin()

func (*TestCmd) ExitStatus

func (tt *TestCmd) ExitStatus() int

exitstatus公开进程的操作系统退出代码 它只会在进程完成后返回一个有效值。

func (*TestCmd) Expect

func (tt *TestCmd) Expect(tplsource string)

Expect将其参数作为模板运行,然后期望 子进程在5s内输出模板的结果。

如果模板以换行符开头,则将删除换行符 匹配前。

func (*TestCmd) ExpectExit

func (tt *TestCmd) ExpectExit()

expectexit期望子进程在5秒内退出 在stdout上打印任何附加文本。

func (*TestCmd) ExpectRegexp

func (tt *TestCmd) ExpectRegexp(regex string) (*regexp.Regexp, []string)

expectregexp要求子进程输出与 在5s内给出正则表达式。

注意,任意数量的输出可能被 正则表达式。这通常意味着不能使用expect 在expectregexp之后。

func (*TestCmd) InputLine

func (tt *TestCmd) InputLine(s string) string

inputline将给定文本写入childs stdin。 这种方法也可以从期望模板调用,例如:

geth.expect(`passphrase:.inputline“password”`)

func (*TestCmd) Interrupt

func (tt *TestCmd) Interrupt()

func (*TestCmd) Kill

func (tt *TestCmd) Kill()

func (*TestCmd) Run

func (tt *TestCmd) Run(name string, args ...string)

运行exec的当前二进制文件,使用argv[0]作为名称,它将触发 该名称的reexec init函数(例如,在cmd/geth/run\test.go中的“geth test”)。

func (*TestCmd) SetTemplateFunc

func (tt *TestCmd) SetTemplateFunc(name string, fn interface{})

func (*TestCmd) StderrText

func (tt *TestCmd) StderrText() string

stderrtext返回到目前为止写入的任何stderr输出。 返回的文本保留Expectexit之后的所有日志行 返回。

func (*TestCmd) WaitExit

func (tt *TestCmd) WaitExit()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL