43 lines
878 B
Go
Raw Permalink Normal View History

2023-07-05 11:14:37 +00:00
package assert_test
import (
"testing"
"git.akyoto.dev/go/assert"
)
type T struct{ A int }
func TestEqual(t *testing.T) {
assert.Equal(t, 0, 0)
assert.Equal(t, "Hello", "Hello")
assert.Equal(t, T{A: 10}, T{A: 10})
}
func TestNotEqual(t *testing.T) {
assert.NotEqual(t, 0, 1)
assert.NotEqual(t, "Hello", "World")
assert.NotEqual(t, &T{A: 10}, &T{A: 10})
assert.NotEqual(t, T{A: 10}, T{A: 20})
}
2023-07-05 11:37:11 +00:00
func TestDeepEqual(t *testing.T) {
2023-07-05 11:14:37 +00:00
assert.DeepEqual(t, 0, 0)
assert.DeepEqual(t, "Hello", "Hello")
2023-07-18 12:35:29 +00:00
assert.DeepEqual(t, []byte("Hello"), []byte("Hello"))
2023-07-05 11:14:37 +00:00
assert.DeepEqual(t, T{A: 10}, T{A: 10})
assert.DeepEqual(t, &T{A: 10}, &T{A: 10})
}
2023-08-31 15:03:52 +00:00
func TestFailEqual(t *testing.T) {
assert.Equal(fail(t), 0, 1)
}
func TestFailNotEqual(t *testing.T) {
assert.NotEqual(fail(t), 0, 0)
}
func TestFailDeepEqual(t *testing.T) {
assert.DeepEqual(fail(t), "Hello", "World")
}