Example #1
0
 public function testPrepend()
 {
     $p1 = P::prepend(1);
     $this->assertEquals([1, 2, 3], P::toArray(P::prepend(1, [2, 3])));
     $this->assertEquals([[1], 2, 3], P::toArray(P::prepend([1], [2, 3])));
     $this->assertEquals([1, 2, 3], P::toArray($p1([2, 3])));
     $a = function () {
         (yield 2);
         (yield 3);
     };
     $this->assertEquals([1, 2, 3], P::toArray(P::prepend(1, $a())));
 }