-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain_test.go
53 lines (45 loc) · 974 Bytes
/
main_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
48
49
50
51
52
53
package main
import (
"os"
"reflect"
"testing"
"time"
)
func AssertDeepEqual(t *testing.T, e interface{}, a interface{}, m string) {
if !reflect.DeepEqual(e, a) {
t.Errorf(m, a)
}
}
func AssertEqual(t *testing.T, e interface{}, a interface{}, m string) {
if a != e {
t.Errorf(m, a)
}
}
func AssertNil(t *testing.T, a interface{}, m string) {
if a != nil {
t.Errorf(m, a)
}
}
func AssertNoError(t *testing.T, err error) {
if err != nil {
t.Fatal(err)
}
}
func AssertPanic(t *testing.T, m string) {
if err := recover(); err == nil {
t.Errorf("No panic on %v", m)
}
}
func AssertPointerEqual(t *testing.T, e interface{}, a interface{}, m string) {
if reflect.ValueOf(a).Pointer() != reflect.ValueOf(e).Pointer() {
t.Errorf(m, a)
}
}
func TestMain(t *testing.T) {
os.Setenv("PORT", "4000")
os.Setenv("REMOTE", "sonarcloud.io")
os.Setenv("SECRET", "012345789abcdef")
os.Setenv("METRIC", "bugs,lines")
go main()
time.Sleep(time.Second)
}