-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnot_equal_test.go
49 lines (45 loc) · 1.03 KB
/
not_equal_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
package assert
import (
"slices"
"testing"
)
func TestNotEqual(t *testing.T) {
spy := newSpy(t)
fatalMessage := "should be equal"
NotEqual(t, "10", "11", fatalMessage)
NotEqual(spy, "70", "70", fatalMessage)
if !spy.calls["Fatal"] {
t.Fatal("not called")
}
if !slices.Equal(spy.params["Fatal"].Args, []any{fatalMessage}) {
t.Fail()
}
}
func TestNotEqualBytes(t *testing.T) {
spy := newSpy(t)
fatalMessage := "should be equal"
msg := "Hello World"
b := []byte(msg)
NotEqual(spy, b, append(b, '7'), fatalMessage)
NotEqual(spy, b, b, fatalMessage)
if !spy.calls["Fatal"] {
t.Fatal("not called")
}
if !slices.Equal(spy.params["Fatal"].Args, []any{fatalMessage}) {
t.Fail()
}
}
func TestNotEqualSlices(t *testing.T) {
spy := newSpy(t)
fatalMessage := "should be equal"
msg := "Hello World"
s := []string{msg}
NotEqual(spy, s, append(s, "7"), fatalMessage)
NotEqual(spy, s, s, fatalMessage)
if !spy.calls["Fatal"] {
t.Fatal("not called")
}
if !slices.Equal(spy.params["Fatal"].Args, []any{fatalMessage}) {
t.Fail()
}
}