several larger changes came together, bit of cleaning too

- all code must be in functions (which must be in classes).
— changes a fair few tests
— also changes api, as method is not recursive, not passed around
- all state in instance vars in compiler (no accessors)
- class is another such variable, surely more coming
all green again
This commit is contained in:
Torsten Ruger
2015-10-06 00:27:13 +03:00
parent 3d36fd1746
commit f4a4ccb98e
37 changed files with 302 additions and 205 deletions

View File

@ -5,10 +5,14 @@ class TestIf < MiniTest::Test
def test_if_basic
@string_input = <<HERE
if( n < 12)
3
else
4
class Object
int main()
if( n < 12)
3
else
4
end
end
end
HERE
@expect = [Virtual::Return ]
@ -17,7 +21,11 @@ HERE
def test_return
@string_input = <<HERE
return 5
class Object
int main()
return 5
end
end
HERE
@expect = [Virtual::Return ]
check
@ -26,15 +34,19 @@ HERE
def test_if_function
@string_input = <<HERE
int itest(int n)
if( n < 12)
"then".putstring()
else
"else".putstring()
class Object
int itest(int n)
if( n < 12)
"then".putstring()
else
"else".putstring()
end
end
int main()
itest(20)
end
end
itest(20)
HERE
@expect = [Virtual::Return ]
check