github.com/xyproto/u-root@v6.0.1-0.20200302025726-5528e0c77a3c+incompatible/cmds/core/elvish/eval/vals/dissoc_test.go (about)

     1  package vals
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/u-root/u-root/cmds/core/elvish/tt"
     7  )
     8  
     9  type customDissocer struct{}
    10  
    11  func (customDissocer) Dissoc(interface{}) interface{} { return "custom ret" }
    12  
    13  var dissocTests = tt.Table{
    14  	Args(MakeMapFromKV("k1", "v1", "k2", "v2"), "k1").Rets(
    15  		eq(MakeMapFromKV("k2", "v2"))),
    16  	Args(customDissocer{}, "x").Rets("custom ret"),
    17  }
    18  
    19  func TestDissoc(t *testing.T) {
    20  	tt.Test(t, tt.Fn("Dissoc", Dissoc), dissocTests)
    21  }