-
Notifications
You must be signed in to change notification settings - Fork 39
/
e2e_test.go
55 lines (40 loc) · 1.01 KB
/
e2e_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
54
55
package gcss
import (
"io/ioutil"
"strconv"
"strings"
"sync"
"testing"
)
func Test_e2e(t *testing.T) {
var wg sync.WaitGroup
for i := 1; i <= 13; i++ {
idx := strconv.Itoa(i)
gcssPath := "test/e2e/actual/" + strings.Repeat("0", 4-len(idx)) + idx + ".gcss"
wg.Add(1)
go func() {
defer wg.Done()
actualCSSPath, err := CompileFile(gcssPath)
if err != nil {
t.Errorf("error occurred [error: %q]", err.Error())
return
}
expectedCSSPath := strings.Replace(actualCSSPath, "actual", "expected", -1)
actualB, err := ioutil.ReadFile(actualCSSPath)
if err != nil {
t.Errorf("error occurred [error: %q]", err.Error())
return
}
expectedB, err := ioutil.ReadFile(expectedCSSPath)
if err != nil {
t.Errorf("error occurred [error: %q]", err.Error())
return
}
if strings.TrimSpace(string(actualB)) != strings.TrimSpace(string(expectedB)) {
t.Errorf("actual result does not match the expected result [path: %q]", gcssPath)
return
}
}()
wg.Wait()
}
}