MCPcopy Create free account
hub / github.com/goplus/py / TestCompile

Function TestCompile

code_test.go:19–44  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17}
18
19func TestCompile(t *testing.T) {
20
21 for _, c := range g_compileCases {
22 code, err := Compile(c.exp, "", c.start)
23 if err != nil {
24 t.Fatal("Compile failed:", err)
25 }
26 defer code.Decref()
27
28 globals := NewDict()
29 defer globals.Decref()
30
31 locals := NewDict()
32 defer locals.Decref()
33
34 ret, err := code.Eval(globals.Obj(), locals.Obj())
35 if err != nil {
36 t.Fatal("Eval failed:", err)
37 }
38 defer ret.Decref()
39
40 if ret.String() != c.ret {
41 t.Fatal("Eval ret:", ret.String())
42 }
43 }
44}
45
46type evalLocalGlobalsCase struct {
47 exp string

Callers

nothing calls this directly

Calls 6

CompileFunction · 0.85
NewDictFunction · 0.85
DecrefMethod · 0.80
EvalMethod · 0.80
ObjMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…