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

Function TestCompiler_CompilerIf

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

Source from the content-addressed store, hash-verified

71 assert.Equal(t, object.GetReturnObject(), 101)
72}
73func TestCompiler_CompilerIf(t *testing.T) {
74 script := `
75int age=10;
76if (age>10){
77 age++;
78}else{
79 age--;
80}
81return age;
82`
83 compiler := NewCompiler().Compiler(script)
84 object := compiler.(*ReturnObject)
85 fmt.Println(object.GetReturnObject())
86 assert.Equal(t, object.GetReturnObject(), 9)
87}
88func TestCompiler_CompilerIf2(t *testing.T) {
89 script := `
90int age=10;

Callers

nothing calls this directly

Calls 3

NewCompilerFunction · 0.85
CompilerMethod · 0.80
GetReturnObjectMethod · 0.80

Tested by

no test coverage detected