-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathparser_test.go
55 lines (49 loc) · 1.22 KB
/
parser_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 report
import (
"bytes"
"fmt"
"github.com/DeNA/unity-meta-check/unity/checker"
"github.com/DeNA/unity-meta-check/util/typedpath"
"github.com/google/go-cmp/cmp"
"reflect"
"testing"
)
func TestNewLineReporterParser(t *testing.T) {
cases := []*checker.CheckResult{
checker.NewCheckResult([]typedpath.SlashPath{}, []typedpath.SlashPath{}),
checker.NewCheckResult([]typedpath.SlashPath{
"path/to/missing1.meta",
"path/to/missing2.meta",
}, []typedpath.SlashPath{}),
checker.NewCheckResult([]typedpath.SlashPath{}, []typedpath.SlashPath{
"path/to/dangling1.meta",
"path/to/dangling2.meta",
}),
checker.NewCheckResult(
[]typedpath.SlashPath{
"path/to/missing1.meta",
"path/to/missing2.meta",
},
[]typedpath.SlashPath{
"path/to/dangling1.meta",
"path/to/dangling2.meta",
},
),
}
for _, result := range cases {
t.Run(fmt.Sprintf("%v", result), func(t *testing.T) {
buf := &bytes.Buffer{}
if err := WriteResult(buf, result); err != nil {
t.Errorf("want nil, got %#v", err)
return
}
parse := NewParser()
actual := parse(buf)
expected := result
if !reflect.DeepEqual(actual, expected) {
t.Error(cmp.Diff(expected, actual))
return
}
})
}
}