(t *testing.T)
| 909 | } |
| 910 | |
| 911 | func TestRuntimeWithModuleImportOptionInstallsDefaultLoader(t *testing.T) { |
| 912 | rt := NewRuntime(WithModuleImport(true)) |
| 913 | defer rt.Close() |
| 914 | |
| 915 | ctx := rt.NewContext() |
| 916 | require.NotNil(t, ctx) |
| 917 | defer ctx.Close() |
| 918 | |
| 919 | result := ctx.Eval(` |
| 920 | (async function() { |
| 921 | const mod = await import("./test/fib_module.js"); |
| 922 | return mod.fib(6); |
| 923 | })() |
| 924 | `, EvalAwait(true)) |
| 925 | defer result.Free() |
| 926 | |
| 927 | require.False(t, result.IsException()) |
| 928 | require.EqualValues(t, 8, result.ToInt32()) |
| 929 | } |
| 930 | |
| 931 | func TestRuntimeSetModuleImportToggle(t *testing.T) { |
| 932 | evalFibImport := func(ctx *Context) *Value { |
nothing calls this directly
no test coverage detected