Skip to content

Commit 00fee51

Browse files
committed
Add test for calling destructuring with incorrect mapper type
1 parent 49f49f5 commit 00fee51

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/test/php/lang/ast/syntax/php/unittest/RecordsTest.class.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace lang\ast\syntax\php\unittest;
22

3+
use lang\Error;
34
use lang\ast\Errors;
45
use lang\ast\unittest\emit\EmittingTest;
56
use lang\{IllegalArgumentException, XPClass};
@@ -183,4 +184,10 @@ public function destructure_and_map_person_record() {
183184
return "{$name} is {$age} year(s) old";
184185
}));
185186
}
187+
188+
#[Test, Expect(class: Error::class, withMessage: '/Argument.+must.+callable/')]
189+
public function destructure_with_incorrect_mapper() {
190+
$p= $this->type('record <T>(int $x, int $y) { }')->newInstance(1, 10);
191+
$p('not.callable');
192+
}
186193
}

0 commit comments

Comments
 (0)