Lines Matching defs:testContext
33 type testContext struct { struct
34 t *testing.T
35 wd string
36 tempDir string
37 env []string
38 cfg *config
39 inputCmd *command
40 lastCmd *command
41 cmdCount int
42 cmdMock func(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error
43 stdinBuffer bytes.Buffer
44 stdoutBuffer bytes.Buffer
45 stderrBuffer bytes.Buffer
48 func withTestContext(t *testing.T, work func(ctx *testContext)) {
70 func (ctx *testContext) getenv(key string) (string, bool) {
80 func (ctx *testContext) environ() []string {
84 func (ctx *testContext) getwd() string {
88 func (ctx *testContext) stdin() io.Reader {
92 func (ctx *testContext) stdout() io.Writer {
96 func (ctx *testContext) stdoutString() string {
100 func (ctx *testContext) stderr() io.Writer {
104 func (ctx *testContext) stderrString() string {
108 …c (ctx *testContext) run(cmd *command, stdin io.Reader, stdout io.Writer, stderr io.Writer) error {
117 func (ctx *testContext) exec(cmd *command) error {
126 func (ctx *testContext) must(exitCode int) *command {
134 func (ctx *testContext) mustFail(exitCode int) string {
141 func (ctx *testContext) updateConfig(cfg *config) {
148 func (ctx *testContext) newCommand(path string, args ...string) *command {
158 func (ctx *testContext) writeFile(fullFileName string, fileContent string) {
170 func (ctx *testContext) symlink(oldname string, newname string) {
185 func (ctx *testContext) readAllString(r io.Reader) string {