Skip to content

Commit eef8baf

Browse files
committed
Add test for static methods used w/ partial function applications
1 parent e0bdbd9 commit eef8baf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,24 @@ public function run() {
256256
Assert::equals('ok', $f('ok', 'test'));
257257
}
258258

259+
#[Test]
260+
public function partial_function_application_static_method() {
261+
$f= $this->run('use lang\ast\unittest\emit\Handle; class %T {
262+
private static function for($impl, $stream) {
263+
return match ($stream) {
264+
STDIN => new $impl(0),
265+
STDOUT => new $impl(1),
266+
STDERR => new $impl(2),
267+
};
268+
}
269+
270+
public function run() {
271+
return self::for(Handle::class, ?);
272+
}
273+
}');
274+
Assert::equals(new Handle(2), $f(STDERR));
275+
}
276+
259277
#[Test]
260278
public function partial_function_application_variadic() {
261279
$f= $this->run('class %T {

0 commit comments

Comments
 (0)