modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2023-12-30 15:02:54 +04:00
parent 97d7d1260a
commit 9e0a434f00
1 changed files with 47 additions and 0 deletions

View File

@ -4,6 +4,11 @@ namespace {
function func36() { function func36() {
return 36; return 36;
} }
function m1($a): array { return [$a]; }
function m1o1($a, $b=1): array { return [$a, $b]; }
function m1v($a, ...$c): array { return [$a, ...$c]; }
function m1o1v($a, $b=1, ...$c): array { return [$a, $b, ...$c]; }
} }
namespace nur\sery\sys { namespace nur\sery\sys {
@ -143,6 +148,48 @@ namespace nur\sery\sys {
self::assertSame(21, func::call($closure)); self::assertSame(21, func::call($closure));
} }
function testFix_args() {
self::assertSame([null], func::call("m1"));
self::assertSame([null], func::call("m1", null));
self::assertSame([null], func::call("m1", null, null));
self::assertSame([null], func::call("m1", null, null, null));
self::assertSame([null], func::call("m1", null, null, null, null));
self::assertSame([1], func::call("m1", 1));
self::assertSame([1], func::call("m1", 1, 2));
self::assertSame([1], func::call("m1", 1, 2, 3));
self::assertSame([1], func::call("m1", 1, 2, 3, 4));
self::assertSame([null, 1], func::call("m1o1"));
self::assertSame([null, 1], func::call("m1o1", null));
self::assertSame([null, null], func::call("m1o1", null, null));
self::assertSame([null, null], func::call("m1o1", null, null, null));
self::assertSame([null, null], func::call("m1o1", null, null, null, null));
self::assertSame([1, 1], func::call("m1o1", 1));
self::assertSame([1, 2], func::call("m1o1", 1, 2));
self::assertSame([1, 2], func::call("m1o1", 1, 2, 3));
self::assertSame([1, 2], func::call("m1o1", 1, 2, 3, 4));
self::assertSame([null], func::call("m1v"));
self::assertSame([null], func::call("m1v", null));
self::assertSame([null, null], func::call("m1v", null, null));
self::assertSame([null, null, null], func::call("m1v", null, null, null));
self::assertSame([null, null, null, null], func::call("m1v", null, null, null, null));
self::assertSame([1], func::call("m1v", 1));
self::assertSame([1, 2], func::call("m1v", 1, 2));
self::assertSame([1, 2, 3], func::call("m1v", 1, 2, 3));
self::assertSame([1, 2, 3, 4], func::call("m1v", 1, 2, 3, 4));
self::assertSame([null, 1], func::call("m1o1v"));
self::assertSame([null, 1], func::call("m1o1v", null));
self::assertSame([null, null], func::call("m1o1v", null, null));
self::assertSame([null, null, null], func::call("m1o1v", null, null, null));
self::assertSame([null, null, null, null], func::call("m1o1v", null, null, null, null));
self::assertSame([1, 1], func::call("m1o1v", 1));
self::assertSame([1, 2], func::call("m1o1v", 1, 2));
self::assertSame([1, 2, 3], func::call("m1o1v", 1, 2, 3));
self::assertSame([1, 2, 3, 4], func::call("m1o1v", 1, 2, 3, 4));
}
function testCall_all() { function testCall_all() {
$c1 = new C1(); $c1 = new C1();
$c2 = new C2(); $c2 = new C2();