MCPcopy Create free account
hub / github.com/buke/quickjs-go / TestRuntimeConfiguration

Function TestRuntimeConfiguration

runtime_test.go:114–137  ·  view source on GitHub ↗

TestRuntimeConfiguration tests runtime configuration setters

(t *testing.T)

Source from the content-addressed store, hash-verified

112
113// TestRuntimeConfiguration tests runtime configuration setters
114func TestRuntimeConfiguration(t *testing.T) {
115 rt := NewRuntime()
116 defer rt.Close()
117
118 // Test all setters for coverage
119 rt.SetMemoryLimit(1024 * 1024)
120 rt.SetExecuteTimeout(5)
121 rt.SetMaxStackSize(16384)
122 rt.SetGCThreshold(2048)
123 rt.SetCanBlock(true)
124 rt.SetCanBlock(false) // Test both branches
125 rt.SetStripInfo(1)
126
127 // Run garbage collection
128 rt.RunGC()
129
130 ctx := rt.NewContext()
131 defer ctx.Close()
132
133 result := ctx.Eval(`"configuration test"`)
134 defer result.Free()
135 require.False(t, result.IsException()) // Check for exceptions instead of error
136 require.Equal(t, "configuration test", result.ToString())
137}
138
139func TestRuntimeDiagnosticsAndRawContext(t *testing.T) {
140 rt := NewRuntime()

Callers

nothing calls this directly

Calls 15

CloseMethod · 0.95
SetMemoryLimitMethod · 0.95
SetExecuteTimeoutMethod · 0.95
SetMaxStackSizeMethod · 0.95
SetGCThresholdMethod · 0.95
SetCanBlockMethod · 0.95
SetStripInfoMethod · 0.95
RunGCMethod · 0.95
NewContextMethod · 0.95
CloseMethod · 0.95
EvalMethod · 0.95
NewRuntimeFunction · 0.85

Tested by

no test coverage detected