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

Function TestContextPostCloseContracts

context_test.go:98–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestContextPostCloseContracts(t *testing.T) {
99 rt := NewRuntime()
100 ctx := rt.NewContext()
101 require.NotNil(t, ctx)
102
103 v := ctx.NewString("post-close-free")
104 require.NotNil(t, v)
105
106 ctx.Close()
107 require.Nil(t, ctx.Runtime())
108 require.False(t, ctx.HasException())
109 require.Nil(t, ctx.Exception())
110 require.False(t, ctx.Schedule(func(*Context) {}))
111 require.NotPanics(t, func() {
112 ctx.Loop()
113 })
114 require.NotPanics(t, func() {
115 v.Free()
116 })
117
118 rt.Close()
119}
120
121func TestContextNewStringUTF16(t *testing.T) {
122 useStableOwnerHooksForLegacySubtests(t)

Callers

nothing calls this directly

Calls 11

NewContextMethod · 0.95
NewStringMethod · 0.95
CloseMethod · 0.95
RuntimeMethod · 0.95
HasExceptionMethod · 0.95
ExceptionMethod · 0.95
ScheduleMethod · 0.95
LoopMethod · 0.95
CloseMethod · 0.95
NewRuntimeFunction · 0.85
FreeMethod · 0.45

Tested by

no test coverage detected