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

Function TestCompiler_CompilerFor2

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

Source from the content-addressed store, hash-verified

58 assert.Equal(t, object.GetReturnObject(), 100*100)
59}
60func TestCompiler_CompilerFor2(t *testing.T) {
61 script := `
62int age = 1 ;
63for(int i = 0;i<100;i++) {
64 age=age+1;
65}
66return age;
67`
68 compiler := NewCompiler().Compiler(script)
69 object := compiler.(*ReturnObject)
70 fmt.Println(object.GetReturnObject())
71 assert.Equal(t, object.GetReturnObject(), 101)
72}
73func TestCompiler_CompilerIf(t *testing.T) {
74 script := `
75int age=10;

Callers

nothing calls this directly

Calls 3

NewCompilerFunction · 0.85
CompilerMethod · 0.80
GetReturnObjectMethod · 0.80

Tested by

no test coverage detected