1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-27 13:48:56 +08:00
hybridgroup.gobot/gobottest/gobottest_test.go
deadprogram 3568719115 Revert "test: increase coverage on test helpers"
This reverts commit 2727b9e535e1f8c1c9f1d80899cb61fcbfbabd61.
2017-05-08 10:46:41 +02:00

43 lines
816 B
Go

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)
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)
if err != `gobottest_test.go:33: 1 - "int", should not equal, 1 - "int"` {
t.Errorf("Refute failed: 1 should not be 1")
}
}
func TestExecCommand(t *testing.T) {
val := ExecCommand("echo", "hello")
Refute(t, val, nil)
}