github.com/elves/elvish@v0.15.0/pkg/eval/vals/dissoc_test.go (about)

     1  package vals
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/elves/elvish/pkg/tt"
     7  )
     8  
     9  type dissocer struct{}
    10  
    11  func (dissocer) Dissoc(interface{}) interface{} { return "custom ret" }
    12  
    13  func TestDissoc(t *testing.T) {
    14  	Test(t, Fn("Dissoc", Dissoc), Table{
    15  		Args(MakeMap("k1", "v1", "k2", "v2"), "k1").Rets(Eq(MakeMap("k2", "v2"))),
    16  		Args(dissocer{}, "x").Rets("custom ret"),
    17  		Args("", "x").Rets(nil),
    18  	})
    19  }