src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/eval/vals/dissoc_test.go (about) 1 package vals 2 3 import ( 4 "testing" 5 6 "src.elv.sh/pkg/tt" 7 ) 8 9 type dissocer struct{} 10 11 func (dissocer) Dissoc(any) any { return "custom ret" } 12 13 func TestDissoc(t *testing.T) { 14 tt.Test(t, Dissoc, 15 Args(MakeMap("k1", "v1", "k2", "v2"), "k1"). 16 Rets(eq(MakeMap("k2", "v2"))), 17 Args(testStructMap{"ls", 1.0}, "score-plus-ten"). 18 Rets(eq(MakeMap("name", "ls", "score", 1.0))), 19 Args(dissocer{}, "x").Rets("custom ret"), 20 Args("", "x").Rets(nil), 21 ) 22 }