Browse Source

Add constants test.

release/v0.1
Rafal Kupiec 2 years ago
parent
commit
03c37c58bb
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
2 changed files with 26 additions and 0 deletions
  1. +21
    -0
      tests/constants_access.aer
  2. +5
    -0
      tests/constants_access.exp

+ 21
- 0
tests/constants_access.aer View File

@ -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);
}
}

+ 5
- 0
tests/constants_access.exp View File

@ -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')

Loading…
Cancel
Save