MCPcopy Create free account
hub / github.com/crossoverJie/gscript / TestCompiler_CompilerFor

Function TestCompiler_CompilerFor

compiler_test.go:30–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28 assert.Equal(t, object.GetReturnObject(), 11)
29}
30func TestCompiler_CompilerFor(t *testing.T) {
31 script := `
32int age = 0 ;
33for(int i = 0;i<100;i++) {
34 age++;
35}
36return age;
37`
38 compiler := NewCompiler().Compiler(script)
39 object := compiler.(*ReturnObject)
40 fmt.Println(object.GetReturnObject())
41 assert.Equal(t, object.GetReturnObject(), 100)
42}
43func TestCompiler_CompilerFor3(t *testing.T) {
44 script := `
45int age = 0 ;

Callers

nothing calls this directly

Calls 3

NewCompilerFunction · 0.85
CompilerMethod · 0.80
GetReturnObjectMethod · 0.80

Tested by

no test coverage detected