-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtgo_test.go
More file actions
91 lines (83 loc) · 2.23 KB
/
tgo_test.go
File metadata and controls
91 lines (83 loc) · 2.23 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package main
import (
"context"
"testing"
)
func TestRun_Pass(t *testing.T) {
flags := Flags{
Bin: "go",
Results: Statuses{StatusFail, StatusNone},
Summary: Statuses{StatusFail, StatusNone},
}
err := run(context.Background(), flags, []string{"./testdata/pass"})
if err != nil {
t.Errorf("expected no error for passing test, got %v", err)
}
}
func TestRun_Fail(t *testing.T) {
flags := Flags{
Bin: "go",
Results: Statuses{StatusFail, StatusNone},
Summary: Statuses{StatusFail, StatusNone},
}
err := run(context.Background(), flags, []string{"./testdata/fail"})
if err == nil {
t.Errorf("expected error for failing test, got nil")
}
}
func TestRun_BuildFail(t *testing.T) {
flags := Flags{
Bin: "go",
Results: Statuses{StatusFail, StatusNone, StatusBuildFail},
Summary: Statuses{StatusFail, StatusNone, StatusBuildFail},
}
err := run(context.Background(), flags, []string{"./testdata/buildfail"})
if err == nil {
t.Errorf("expected error for build failing test, got nil")
}
}
func TestRun_Skip(t *testing.T) {
flags := Flags{
Bin: "go",
Results: Statuses{StatusFail, StatusNone},
Summary: Statuses{StatusFail, StatusNone},
}
err := run(context.Background(), flags, []string{"./testdata/skip"})
if err != nil {
t.Errorf("expected no error for skipping test, got %v", err)
}
}
func TestRun_Bench(t *testing.T) {
flags := Flags{
Bin: "go",
Results: Statuses{StatusBench},
Summary: Statuses{StatusBench},
}
err := run(context.Background(), flags, []string{"-bench", ".", "./testdata/bench"})
if err != nil {
t.Errorf("expected no error for benchmark, got %v", err)
}
}
func TestRun_Output(t *testing.T) {
flags := Flags{
Bin: "go",
Results: Statuses{StatusPass},
Summary: Statuses{StatusPass},
V: V4,
}
err := run(context.Background(), flags, []string{"./testdata/output"})
if err != nil {
t.Errorf("expected no error for test with output, got %v", err)
}
}
func TestRun_Crash(t *testing.T) {
flags := Flags{
Bin: "go",
Results: Statuses{StatusFail, StatusNone},
Summary: Statuses{StatusFail, StatusNone},
}
err := run(context.Background(), flags, []string{"./testdata/crash"})
if err == nil {
t.Errorf("expected error for crashed test, got nil")
}
}