modifs.mineures sans commentaires
This commit is contained in:
parent
9e0a434f00
commit
8011646209
|
@ -1,14 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace {
|
||||
function func36() {
|
||||
return 36;
|
||||
}
|
||||
function func36(): int { 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]; }
|
||||
function func_m1($a): array { return [$a]; }
|
||||
function func_o1($b=9): array { return [$b]; }
|
||||
function func_v(...$c): array { return [...$c]; }
|
||||
function func_m1o1($a, $b=9): array { return [$a, $b]; }
|
||||
function func_m1v($a, ...$c): array { return [$a, ...$c]; }
|
||||
function func_m1o1v($a, $b=9, ...$c): array { return [$a, $b, ...$c]; }
|
||||
function func_o1v($b=9, ...$c): array { return [$b, ...$c]; }
|
||||
}
|
||||
|
||||
namespace nur\sery\sys {
|
||||
|
@ -148,46 +149,86 @@ namespace nur\sery\sys {
|
|||
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));
|
||||
function test_prepare_fill() {
|
||||
# vérifier que les arguments sont bien remplis, en fonction du fait qu'ils
|
||||
# soient obligatoires, facultatifs ou variadiques
|
||||
|
||||
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));
|
||||
# m1
|
||||
self::assertSame([null], func::call("func_m1"));
|
||||
self::assertSame([null], func::call("func_m1", null));
|
||||
self::assertSame([null], func::call("func_m1", null, null));
|
||||
self::assertSame([null], func::call("func_m1", null, null, null));
|
||||
self::assertSame([null], func::call("func_m1", null, null, null, null));
|
||||
self::assertSame([1], func::call("func_m1", 1));
|
||||
self::assertSame([1], func::call("func_m1", 1, 2));
|
||||
self::assertSame([1], func::call("func_m1", 1, 2, 3));
|
||||
self::assertSame([1], func::call("func_m1", 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));
|
||||
# o1
|
||||
self::assertSame([9], func::call("func_o1"));
|
||||
self::assertSame([null], func::call("func_o1", null));
|
||||
self::assertSame([null], func::call("func_o1", null, null));
|
||||
self::assertSame([null], func::call("func_o1", null, null, null));
|
||||
self::assertSame([null], func::call("func_o1", null, null, null, null));
|
||||
self::assertSame([1], func::call("func_o1", 1));
|
||||
self::assertSame([1], func::call("func_o1", 1, 2));
|
||||
self::assertSame([1], func::call("func_o1", 1, 2, 3));
|
||||
self::assertSame([1], func::call("func_o1", 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));
|
||||
# v
|
||||
self::assertSame([], func::call("func_v"));
|
||||
self::assertSame([null], func::call("func_v", null));
|
||||
self::assertSame([null, null], func::call("func_v", null, null));
|
||||
self::assertSame([null, null, null], func::call("func_v", null, null, null));
|
||||
self::assertSame([null, null, null, null], func::call("func_v", null, null, null, null));
|
||||
self::assertSame([1], func::call("func_v", 1));
|
||||
self::assertSame([1, 2], func::call("func_v", 1, 2));
|
||||
self::assertSame([1, 2, 3], func::call("func_v", 1, 2, 3));
|
||||
self::assertSame([1, 2, 3, 4], func::call("func_v", 1, 2, 3, 4));
|
||||
|
||||
# m1o1
|
||||
self::assertSame([null, 9], func::call("func_m1o1"));
|
||||
self::assertSame([null, 9], func::call("func_m1o1", null));
|
||||
self::assertSame([null, null], func::call("func_m1o1", null, null));
|
||||
self::assertSame([null, null], func::call("func_m1o1", null, null, null));
|
||||
self::assertSame([null, null], func::call("func_m1o1", null, null, null, null));
|
||||
self::assertSame([1, 9], func::call("func_m1o1", 1));
|
||||
self::assertSame([1, 2], func::call("func_m1o1", 1, 2));
|
||||
self::assertSame([1, 2], func::call("func_m1o1", 1, 2, 3));
|
||||
self::assertSame([1, 2], func::call("func_m1o1", 1, 2, 3, 4));
|
||||
|
||||
# m1v
|
||||
self::assertSame([null], func::call("func_m1v"));
|
||||
self::assertSame([null], func::call("func_m1v", null));
|
||||
self::assertSame([null, null], func::call("func_m1v", null, null));
|
||||
self::assertSame([null, null, null], func::call("func_m1v", null, null, null));
|
||||
self::assertSame([null, null, null, null], func::call("func_m1v", null, null, null, null));
|
||||
self::assertSame([1], func::call("func_m1v", 1));
|
||||
self::assertSame([1, 2], func::call("func_m1v", 1, 2));
|
||||
self::assertSame([1, 2, 3], func::call("func_m1v", 1, 2, 3));
|
||||
self::assertSame([1, 2, 3, 4], func::call("func_m1v", 1, 2, 3, 4));
|
||||
|
||||
# m1o1v
|
||||
self::assertSame([null, 9], func::call("func_m1o1v"));
|
||||
self::assertSame([null, 9], func::call("func_m1o1v", null));
|
||||
self::assertSame([null, null], func::call("func_m1o1v", null, null));
|
||||
self::assertSame([null, null, null], func::call("func_m1o1v", null, null, null));
|
||||
self::assertSame([null, null, null, null], func::call("func_m1o1v", null, null, null, null));
|
||||
self::assertSame([1, 9], func::call("func_m1o1v", 1));
|
||||
self::assertSame([1, 2], func::call("func_m1o1v", 1, 2));
|
||||
self::assertSame([1, 2, 3], func::call("func_m1o1v", 1, 2, 3));
|
||||
self::assertSame([1, 2, 3, 4], func::call("func_m1o1v", 1, 2, 3, 4));
|
||||
|
||||
# o1v
|
||||
self::assertSame([9], func::call("func_o1v"));
|
||||
self::assertSame([null], func::call("func_o1v", null));
|
||||
self::assertSame([null, null], func::call("func_o1v", null, null));
|
||||
self::assertSame([null, null, null], func::call("func_o1v", null, null, null));
|
||||
self::assertSame([null, null, null, null], func::call("func_o1v", null, null, null, null));
|
||||
self::assertSame([1], func::call("func_o1v", 1));
|
||||
self::assertSame([1, 2], func::call("func_o1v", 1, 2));
|
||||
self::assertSame([1, 2, 3], func::call("func_o1v", 1, 2, 3));
|
||||
self::assertSame([1, 2, 3, 4], func::call("func_o1v", 1, 2, 3, 4));
|
||||
}
|
||||
|
||||
function testCall_all() {
|
||||
|
|
Loading…
Reference in New Issue