-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain_test.go
40 lines (37 loc) · 884 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
package main
import (
"io/ioutil"
"os"
"strings"
"testing"
)
func TestMain_Simple(t *testing.T) {
// arrange
in = "./testdata/simple"
out = "./testdata/simple/result/merged.go"
// action
main()
// verify
result, _ := ioutil.ReadFile(out)
expected, _ := ioutil.ReadFile("./testdata/simple/result/merged_expected.go")
if !strings.EqualFold(string(expected), string(result)) {
t.Error("Merged result is not in expected form")
}
// cleanup
os.Remove(out)
}
func TestMain_Complex(t *testing.T) {
// arrange
in = "./testdata/complex"
out = "./testdata/complex/result/merged.go"
// action
main()
// verify
result, _ := ioutil.ReadFile(out)
expected, _ := ioutil.ReadFile("./testdata/complex/result/merged_expected.go")
if !strings.EqualFold(string(expected), string(result)) {
t.Error("Merged result is not in expected form")
}
// cleanup
os.Remove(out)
}