hybridgroup.gobot/gobottest/gobottest_test.go

38 lines
718 B
Go
Raw Normal View History

package gobottest
import "testing"
func TestAssert(t *testing.T) {
err := ""
errFunc = func(t *testing.T, message string) {
err = message
}
Assert(t, 1, 1)
if err != "" {
t.Errorf("Assert failed: 1 should equal 1")
}
Assert(t, 1, 2)
2016-02-23 14:08:49 +08:00
if err != `gobottest_test.go:16: 1 - "int", should equal, 2 - "int"` {
t.Errorf("Assert failed: 1 should not equal 2")
}
}
func TestRefute(t *testing.T) {
err := ""
errFunc = func(t *testing.T, message string) {
err = message
}
Refute(t, 1, 2)
if err != "" {
t.Errorf("Refute failed: 1 should not be 2")
}
Refute(t, 1, 1)
2016-02-23 14:08:49 +08:00
if err != `gobottest_test.go:33: 1 - "int", should not equal, 1 - "int"` {
t.Errorf("Refute failed: 1 should not be 1")
}
}