Adds base call error tests (#436)

This adds tests that pass without changing deferred error handling.
There are some tests that don't pass even without deferred error
handling. I'll add those in a separate PR.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2022-04-04 11:13:29 +08:00
committed by GitHub
parent 2664b1eb62
commit 673a657e08
16 changed files with 449 additions and 213 deletions

View File

@@ -692,6 +692,7 @@ func TestModule_buildGlobalInstances(t *testing.T) {
func TestModule_buildFunctionInstances(t *testing.T) {
nopCode := &Code{nil, []byte{OpcodeEnd}}
m := Module{
TypeSection: []*FunctionType{{}},
ImportSection: []*Import{{Type: ExternTypeFunc}},
NameSection: &NameSection{
FunctionNames: NameMap{
@@ -706,7 +707,7 @@ func TestModule_buildFunctionInstances(t *testing.T) {
actual := m.buildFunctions()
expectedNames := []string{"unknown", "two", "unknown", "four", "five"}
for i, f := range actual {
require.Equal(t, expectedNames[i], f.Name)
require.Equal(t, expectedNames[i], f.DebugName)
require.Equal(t, nopCode.Body, f.Body)
}
}