[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:
Adnan Ioricce 2024-10-06 13:09:47 +00:00
parent a7d56eaf86
commit 77c0845f61
2 changed files with 42 additions and 0 deletions

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

@ -0,0 +1,7 @@
var a = 0;
a + 1;
print a + 1;
a = 2;
print a + 1;
var b = 3;
print a + b