From 58618a4d27d4780614dc72e55b1e779abf8c9bcd Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 17 Apr 2019 12:24:32 +0200 Subject: [PATCH] Add another test - constructor overloading. --- tests/overloading_constructor.aer | 18 ++++++++++++++++++ tests/overloading_constructor.exp | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 tests/overloading_constructor.aer create mode 100644 tests/overloading_constructor.exp diff --git a/tests/overloading_constructor.aer b/tests/overloading_constructor.aer new file mode 100644 index 0000000..fa45f28 --- /dev/null +++ b/tests/overloading_constructor.aer @@ -0,0 +1,18 @@ +class Test { + object __construct(string $a) { + print("$a\n"); + } + + object __construct(int $a, int $b) { + print("$a + $b = ", $a + $b, "\n"); + } + +} + +class Program { + void main() { + object $a, $b; + $a = new Test('Hello world!'); + $b = new Test(4, 7); + } +} diff --git a/tests/overloading_constructor.exp b/tests/overloading_constructor.exp new file mode 100644 index 0000000..7305267 --- /dev/null +++ b/tests/overloading_constructor.exp @@ -0,0 +1,2 @@ +Hello world! +4 + 7 = 11 \ No newline at end of file