-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
- platform: mac
- code
func TestName(t *testing.T) {
const code = `
var name = "test_hello";
function main() {
}
main();
`
runtime := quickjs.NewRuntime()
context := runtime.NewContext()
defer context.Free()
for {
val, err := context.Eval(code)
if err != nil {
fmt.Printf("%#v\n", err)
time.Sleep(time.Second)
continue
}
g:=context.Globals()
fmt.Println(g.Get("name"),val)
time.Sleep(time.Millisecond*10)
val.Free()
}
}- output
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
&quickjs.Error{Cause:"", Stack:" at code:1\n"}
test_hello undefined
Metadata
Metadata
Assignees
Labels
No labels