diff --git a/tests/class_tests.lox b/tests/class_tests.lox new file mode 100644 index 0000000..e7ae390 --- /dev/null +++ b/tests/class_tests.lox @@ -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(); + diff --git a/tests/vars.lox b/tests/vars.lox new file mode 100644 index 0000000..56e580c --- /dev/null +++ b/tests/vars.lox @@ -0,0 +1,7 @@ +var a = 0; +a + 1; +print a + 1; +a = 2; +print a + 1; +var b = 3; +print a + b