Skip to content

Commit 69a826c

Browse files
committed
Add match expression goto tests
1 parent 1118e22 commit 69a826c

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

Zend/tests/match/021.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Test compilation error trying to goto into a match expression
3+
--FILE--
4+
<?php
5+
6+
goto match_expression_false_arm;
7+
8+
match (true) {
9+
false => {
10+
match_expression_false_arm:
11+
echo 'Should not work';
12+
}
13+
}
14+
15+
--EXPECTF--
16+
Fatal error: 'goto' into loop or switch statement is disallowed in %s on line %d

Zend/tests/match/022.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Test jumping out of match arm using goto
3+
--FILE--
4+
<?php
5+
6+
match (true) {
7+
true => {
8+
goto after_match_expression;
9+
echo "Never executed\n";
10+
}
11+
}
12+
13+
after_match_expression:
14+
echo "After match expression";
15+
16+
--EXPECT--
17+
After match expression

0 commit comments

Comments
 (0)