diff --git a/tests/callback_function.aer b/tests/callback_function.aer new file mode 100644 index 0000000..1cca0c3 --- /dev/null +++ b/tests/callback_function.aer @@ -0,0 +1,15 @@ +class Program { + + function main(string[] $args) { + callback $y = function() { + callback $a = 'printf'; + $a("I'm alive\n"); + var_dump($a); + }; + $y(); + var_dump($y); + string $a = 'printf'; + var_dump($a); + } + +} diff --git a/tests/callback_function.exp b/tests/callback_function.exp new file mode 100644 index 0000000..5a63841 --- /dev/null +++ b/tests/callback_function.exp @@ -0,0 +1,4 @@ +I'm alive +callback(6 'printf') +callback(11 '{closure_1}') +string(6 'printf') diff --git a/tests/reference_test.aer b/tests/reference_test.aer new file mode 100644 index 0000000..09073ac --- /dev/null +++ b/tests/reference_test.aer @@ -0,0 +1,13 @@ +class Program { + + function add_by_ref(int &$val) { + $val += 7; + } + + function main() { + int $num = 7; + $this->add_by_ref($num); + var_dump($num); + } + +} diff --git a/tests/reference_test.exp b/tests/reference_test.exp new file mode 100644 index 0000000..a7fce3e --- /dev/null +++ b/tests/reference_test.exp @@ -0,0 +1 @@ +int(14)