Skip to content

Commit cdac4cf

Browse files
committed
Add test for pipe precedence
Currently consistent with the native PHP implementation, see https://externals.io/message/128473
1 parent afb1b63 commit cdac4cf

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/test/php/lang/ast/unittest/emit/PipelinesTest.class.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use lang\Error;
44
use test\verify\Runtime;
5-
use test\{Assert, Expect, Test, Values};
5+
use test\{Assert, Expect, Ignore, Test, Values};
66

77
/** @see https://wiki.php.net/rfc/pipe-operator-v3 */
88
class PipelinesTest extends EmittingTest {
@@ -346,4 +346,19 @@ public function run() {
346346

347347
Assert::equals([2, 3, 4], $r);
348348
}
349+
350+
#[Test, Ignore('See https://externals.io/message/128473')]
351+
public function pipe_precedence_challenges() {
352+
$r= $this->run('class %T {
353+
public function run() {
354+
ob_start();
355+
356+
42 |> fn($x) => $x < 42 |> fn($x) => var_dump($x);
357+
358+
return ob_get_clean();
359+
}
360+
}');
361+
362+
Assert::equals("bool(false)\n", $r);
363+
}
349364
}

0 commit comments

Comments
 (0)