-
Notifications
You must be signed in to change notification settings - Fork 1
/
hamcrest_lt_test.go
46 lines (44 loc) · 1.14 KB
/
hamcrest_lt_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
package assert
import "testing"
func TestLt(t *testing.T) {
{
err := AssertThat(3, Lt(4))
if err != nil {
t.Fatal("expect nil")
}
}
{
err := AssertThat(4, Lt(3))
if err == nil {
t.Fatal("expect nil")
}
}
{
err := AssertThat(4, Lt(3))
expectedValue := "expected <3> is less than <4>"
if err.Error() != expectedValue {
t.Fatalf("error message missmatch, expected '%v' but was '%v'", expectedValue, err.Error())
}
}
{
err := AssertThat(4, Lt(3).Message("msg"))
expectedValue := "msg, expected <3> is less than <4>"
if err.Error() != expectedValue {
t.Fatalf("error message missmatch, expected '%v' but was '%v'", expectedValue, err.Error())
}
}
{
err := AssertThat(4.1, Lt(3))
expectedValue := "expected type int but got float64"
if err.Error() != expectedValue {
t.Fatalf("error message missmatch, expected '%v' but was '%v'", expectedValue, err.Error())
}
}
{
err := AssertThat(4.1, Lt(3).Message("msg"))
expectedValue := "msg, expected type int but got float64"
if err.Error() != expectedValue {
t.Fatalf("error message missmatch, expected '%v' but was '%v'", expectedValue, err.Error())
}
}
}