-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdiffer_test.go
More file actions
86 lines (76 loc) · 1.6 KB
/
Copy pathdiffer_test.go
File metadata and controls
86 lines (76 loc) · 1.6 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
package sweet
import (
. "github.com/onsi/gomega"
)
type differSuite struct{}
func (s *differSuite) TestGomegaStruct(t T) {
failMessage := `Expected
<*failtests.testStruct | 0xc00000e880>: {
StringValue: "this is a string",
IntValue: 1234,
BoolValue: true,
}
to equal
<*failtests.testStruct | 0xc00000e8a0>: {
StringValue: "this is not a string",
IntValue: 1324,
BoolValue: false,
}`
d := newDiffer()
res := d.ProcessMessage(failMessage)
Expect(res).To(Equal(`Expected
<*failtests.testStruct | 0xc00000e880>: {
StringValue: "this is a string",
IntValue: 1234,
BoolValue: true,
}
to equal
<*failtests.testStruct | 0xc00000e8a0>: {
StringValue: "this is not a string",
IntValue: 1324,
BoolValue: false,
}
Diff
<*failtests.testStruct | 0xc00000e8[31m8[0m[32ma[0m0>: {
StringValue: "this is [32mnot [0ma string",
IntValue: 1[31m2[0m3[32m2[0m4,
BoolValue: [31mtru[0m[32mfals[0me,
}
`))
}
func (s *differSuite) TestGomegaString(t T) {
failMessage := `Expected
<string>:
this
is
a
string?
to equal
<string>:
this
is
a string
`
d := newDiffer()
res := d.ProcessMessage(failMessage)
// fmt.Printf("%s\n", res)
Expect(res).To(Equal(`Expected
<string>:
this
is
a
string?
to equal
<string>:
this
is
a string
Diff
<string>:
[31m [0mthis
[32m [0mis[32m [0m
a[31m
[0m[32m [0mstring[31m?[0m[32m
[0m
`))
}