mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-04 10:57:50 +08:00
6e36058d0a
- Use reflection to derive function name. - Take test cases as variadic arguments, instead of requiring them to be wrapped in a Table. - Support naming test cases. - Run test cases as subtests with t.Run.
29 lines
446 B
Go
29 lines
446 B
Go
package vars
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"src.elv.sh/pkg/tt"
|
|
)
|
|
|
|
var Args = tt.Args
|
|
|
|
func TestBlackhole(t *testing.T) {
|
|
v := NewBlackhole()
|
|
err := v.Set("foo")
|
|
if err != nil {
|
|
t.Errorf("v.Set(%q) -> %v, want nil", "foo", err)
|
|
}
|
|
val := v.Get()
|
|
if val != nil {
|
|
t.Errorf("v.Get() -> %v, want nil", val)
|
|
}
|
|
}
|
|
|
|
func TestIsBlackhole(t *testing.T) {
|
|
tt.Test(t, IsBlackhole,
|
|
Args(NewBlackhole()).Rets(true),
|
|
Args(FromInit("")).Rets(false),
|
|
)
|
|
}
|