From 03c37c58bb01853e177eb6f5b5cc4f2ba865e2c4 Mon Sep 17 00:00:00 2001 From: belliash Date: Tue, 7 May 2019 08:42:42 +0200 Subject: [PATCH] Add constants test. --- tests/constants_access.aer | 21 +++++++++++++++++++++ tests/constants_access.exp | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 tests/constants_access.aer create mode 100644 tests/constants_access.exp diff --git a/tests/constants_access.aer b/tests/constants_access.aer new file mode 100644 index 0000000..dd4761c --- /dev/null +++ b/tests/constants_access.aer @@ -0,0 +1,21 @@ +define TEST_CONSTANT 'This is a global constant'; + +class Program { + const TEST_CONSTANT = 'This is a class constant'; + + void constant_test() { + const TEST_CONSTANT = 'This is a local constant'; + var_dump(TEST_CONSTANT); + } + + void main() { + int $var = 69; + var_dump(TEST_CONSTANT); + $this->constant_test(); + var_dump(TEST_CONSTANT); + var_dump($this->TEST_CONSTANT); + const TEST_CONSTANT = 'Local constant overrides a global constant'; + var_dump(TEST_CONSTANT); + } + +} diff --git a/tests/constants_access.exp b/tests/constants_access.exp new file mode 100644 index 0000000..0d8f265 --- /dev/null +++ b/tests/constants_access.exp @@ -0,0 +1,5 @@ +string(25 'This is a global constant') +string(24 'This is a local constant') +string(25 'This is a global constant') +string(24 'This is a class constant') +string(42 'Local constant overrides a global constant') \ No newline at end of file