-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreflight.go
More file actions
44 lines (34 loc) · 1.14 KB
/
preflight.go
File metadata and controls
44 lines (34 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package preflight
import (
"os"
"testing"
"vincent.click/pkg/preflight/captor"
"vincent.click/pkg/preflight/expect"
"vincent.click/pkg/preflight/stream"
)
// Test provides utilities for testing
type Test struct {
*testing.T
}
// Expect returns a new value-based expectation
func (t *Test) Expect(actual interface{}) expect.Expectation {
return expect.Value(t.T, actual)
}
// ExpectFile returns a set of expectations about a file
func (t *Test) ExpectFile(f *os.File) stream.Expectations {
return stream.ExpectFile(t.T, f)
}
// ExpectWritten returns a set of expectations about data written to a stream
func (t *Test) ExpectWritten(consumer stream.Consumer) stream.Expectations {
return stream.ExpectWritten(t.T, consumer)
}
// ExpectExitCode returns an expectation about a captured exit code
func (t *Test) ExpectExitCode(act captor.Action) expect.Expectation {
code := Captor.CaptureExitCode(act)
return expect.Value(t.T, code)
}
// ExpectPanic returns an expectation about the cause of a panicking goroutine
func (t *Test) ExpectPanic(act captor.Action) expect.Expectation {
cause := Captor.CapturePanic(act)
return expect.Value(t.T, cause)
}