/
runner_test.go
47 lines (37 loc) · 919 Bytes
/
runner_test.go
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
45
46
47
package sweet
import (
"os/exec"
"syscall"
. "github.com/onsi/gomega"
)
type ReturnCodeSuite struct{}
func (s *ReturnCodeSuite) TestFailureReturnCode(t T) {
// This is SUPER meta and weird. We're actually going to run
// "go test" on the "failtests" directory and make sure it returns
// a non-zero status code
cmd := exec.Command("go", "test")
cmd.Dir = "failtests"
err := cmd.Run()
execErr, ok := err.(*exec.ExitError)
Expect(ok).To(BeTrue())
waitStatus, ok := execErr.Sys().(syscall.WaitStatus)
Expect(ok).To(BeTrue())
Expect(waitStatus.ExitStatus()).To(Equal(1))
}
type RunnerSuite struct{}
func (s *RunnerSuite) TestFailInGoroutines(t T) {
/*ch := make(chan struct{})
go func() {
defer close(ch)
t.FailNow()
}()
<-ch*/
}
func (s *RunnerSuite) TestGomegaFailInGoroutines(t T) {
/*ch := make(chan struct{})
go func() {
defer close(ch)
Expect(false).To(BeTrue())
}()
<-ch*/
}