Этот коммит содержится в:
родитель
17e0fb4653
Коммит
03c37c58bb
21
tests/constants_access.aer
Обычный файл
21
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);
|
||||
}
|
||||
|
||||
}
|
5
tests/constants_access.exp
Обычный файл
5
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')
|
Загрузка…
x
Ссылка в новой задаче
Block a user