elvish/pkg/eval/vars/blackhole_test.go

27 lines
478 B
Go
Raw Normal View History

2019-04-20 02:44:11 +08:00
package vars
import (
"testing"
2019-12-24 04:00:59 +08:00
"github.com/elves/elvish/pkg/tt"
2019-04-20 02:44:11 +08:00
)
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, tt.Fn("IsBlackhole", IsBlackhole), tt.Table{
tt.Args(NewBlackhole()).Rets(true),
tt.Args(FromInit("")).Rets(false),
})
}