[Chapter13&Inheritance] - Adding tests;Bugs found
- Refactors will be necessary, the interpreter is not working as expected - Try to execute the tests to check the errors - It seems some funcionality with the scanner or resolver is not working - Debugging is necessary.
This commit is contained in:
parent
a7d56eaf86
commit
77c0845f61
35
tests/class_tests.lox
Normal file
35
tests/class_tests.lox
Normal file
@ -0,0 +1,35 @@
|
||||
class A {
|
||||
method() {
|
||||
print "A method";
|
||||
}
|
||||
}
|
||||
|
||||
class B < A {
|
||||
method() {
|
||||
print "B method";
|
||||
}
|
||||
|
||||
test() {
|
||||
super.method();
|
||||
}
|
||||
}
|
||||
|
||||
class C < B {}
|
||||
|
||||
C().test();
|
||||
|
||||
class Doughnut {
|
||||
cook() {
|
||||
print "Fry until golden brown.";
|
||||
}
|
||||
}
|
||||
|
||||
class BostonCream < Doughnut {
|
||||
cook() {
|
||||
super.cook();
|
||||
print "Pipe full of custard and coat with chocolate.";
|
||||
}
|
||||
}
|
||||
|
||||
BostonCream().cook();
|
||||
|
7
tests/vars.lox
Normal file
7
tests/vars.lox
Normal file
@ -0,0 +1,7 @@
|
||||
var a = 0;
|
||||
a + 1;
|
||||
print a + 1;
|
||||
a = 2;
|
||||
print a + 1;
|
||||
var b = 3;
|
||||
print a + b
|
Loading…
Reference in New Issue
Block a user