(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestFuncWrongRet(t *testing.T) { |
| 105 | store := NewStore(NewEngine()) |
| 106 | cb := func(caller *Caller, args []Val) ([]Val, *Trap) { |
| 107 | return []Val{ValI64(3)}, nil |
| 108 | } |
| 109 | i32 := NewValType(KindI32) |
| 110 | f := NewFunc(store, NewFuncType([]*ValType{}, []*ValType{i32}), cb) |
| 111 | |
| 112 | var caught interface{} |
| 113 | func() { |
| 114 | defer func() { caught = recover() }() |
| 115 | f.Call(store) |
| 116 | }() |
| 117 | require.NotNil(t, caught, "expected a panic") |
| 118 | require.IsType(t, caught, string("")) |
| 119 | require.Containsf(t, caught.(string), "callback produced wrong type of result", "wrong panic message %s", caught) |
| 120 | } |
| 121 | |
| 122 | func TestFuncWrongRet2(t *testing.T) { |
| 123 | store := NewStore(NewEngine()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…