-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhamcrest_not_test.go
More file actions
52 lines (46 loc) · 1.08 KB
/
hamcrest_not_test.go
File metadata and controls
52 lines (46 loc) · 1.08 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
package assert
import "testing"
func TestNotImplementsMatcher(t *testing.T) {
m := Not(NilValue())
var expected *Matcher
err := AssertThat(m, Implements(expected))
if err != nil {
t.Fatal(err)
}
}
func TestNotMatches(t *testing.T) {
err := AssertThat(t, Not(NilValue()))
if err != nil {
t.Fatal(err)
}
}
func TestNotDescription(t *testing.T) {
err := AssertThat(t, Not(NotNilValue()))
if err == nil {
t.Fatal("expect not nil")
}
err = AssertThat(err.Error(), Is("not expected not nil value"))
if err != nil {
t.Fatal(err)
}
}
func TestNotDescriptionWithMessage(t *testing.T) {
err := AssertThat(t, Not(NotNilValue()).Message("foo"))
if err == nil {
t.Fatal("expect not nil")
}
err = AssertThat(err.Error(), Is("foo, not expected not nil value"))
if err != nil {
t.Fatal(err)
}
}
func TestNotDescriptionWithMessageMessage(t *testing.T) {
err := AssertThat(t, Not(NotNilValue().Message("bar")).Message("foo"))
if err == nil {
t.Fatal("expect not nil")
}
err = AssertThat(err.Error(), Is("foo, not bar, expected not nil value"))
if err != nil {
t.Fatal(err)
}
}