github.com/elves/elvish@v0.15.0/pkg/eval/vars/blackhole_test.go (about)

     1  package vars
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/elves/elvish/pkg/tt"
     7  )
     8  
     9  func TestBlackhole(t *testing.T) {
    10  	v := NewBlackhole()
    11  	err := v.Set("foo")
    12  	if err != nil {
    13  		t.Errorf("v.Set(%q) -> %v, want nil", "foo", err)
    14  	}
    15  	val := v.Get()
    16  	if val != nil {
    17  		t.Errorf("v.Get() -> %v, want nil", val)
    18  	}
    19  }
    20  
    21  func TestIsBlackhole(t *testing.T) {
    22  	tt.Test(t, tt.Fn("IsBlackhole", IsBlackhole), tt.Table{
    23  		tt.Args(NewBlackhole()).Rets(true),
    24  		tt.Args(FromInit("")).Rets(false),
    25  	})
    26  }