-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsistent_test.go
45 lines (37 loc) · 1.04 KB
/
consistent_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
package gomml_test
import (
"strings"
"testing"
"time"
"github.com/golang/mock/gomock"
"github.com/utisam/gomml"
)
func TestConsistent(t *testing.T) {
consistentNow := gomml.Consistent(gomml.Now())
now := time.Now()
if !consistentNow.Matches(now) {
t.Errorf("consistentNow.Matches(%v)", now)
}
if !consistentNow.Matches(now) {
t.Errorf("consistentNow.Matches(%v)", now)
}
}
func TestConsistent__inconsistent(t *testing.T) {
consistentNow := gomml.Consistent(gomml.Now())
if now := time.Now(); !consistentNow.Matches(now) {
t.Errorf("consistentNow.Matches(%v)", now)
}
if now := time.Now(); consistentNow.Matches(now) {
t.Errorf("consistentNow.Matches(%v)", now)
}
}
func Test_consistentMatcher_String(t *testing.T) {
m := gomml.Consistent(gomock.Any())
if got := m.String(); !strings.HasSuffix(got, " and must be consistent") {
t.Errorf("consistentAny.String() = %v", got)
}
m.Matches(nil)
if got := m.String(); !strings.Contains(got, " and must be consistent with ") {
t.Errorf("consistentAny.String() = %v", got)
}
}