Skip to content

Commit a0f263b

Browse files
committed
refactor module tests to shared compile helper
1 parent ada1e2c commit a0f263b

2 files changed

Lines changed: 47 additions & 149 deletions

File tree

vibes/capability_test_helpers_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ func compileScriptDefault(t testing.TB, source string) *Script {
2121
return compileScriptWithConfig(t, Config{}, source)
2222
}
2323

24+
func compileScriptWithEngine(t testing.TB, engine *Engine, source string) *Script {
25+
t.Helper()
26+
script, err := engine.Compile(source)
27+
if err != nil {
28+
t.Fatalf("compile failed: %v", err)
29+
}
30+
return script
31+
}
32+
2433
func callScript(t testing.TB, ctx context.Context, script *Script, fn string, args []Value, opts CallOptions) Value {
2534
t.Helper()
2635
result, err := script.Call(ctx, fn, args, opts)

0 commit comments

Comments
 (0)