refactor: Cleanup git state - commit all staged changes
Major refactoring cleanup: - Add new controller architecture (class-controller-*.php) - Add new settings-v2 UI (views/settings-v2/) - Add new CSS architecture (agentic-sidebar.css, tokens) - Add esbuild build pipeline (scripts/build.js, package.json) - Add composer dependencies (vendor/) - Add frontend src directory (assets/js/src/index.jsx) - Add documentation files - Remove old/obsolete files (class-settings.php, old CSS) This commits all pending changes from previous refactoring efforts.
This commit is contained in:
47
vendor/parsica-php/parsica/tests/Internal/FP/CurryTest.php
vendored
Normal file
47
vendor/parsica-php/parsica/tests/Internal/FP/CurryTest.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of the Parsica library.
|
||||
*
|
||||
* Copyright (c) 2020 Mathias Verraes <mathias@verraes.net>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Tests\Parsica\Parsica\Internal\FP;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use function Parsica\Parsica\Curry\curry;
|
||||
|
||||
final class CurryTest extends TestCase
|
||||
{
|
||||
/** @test */
|
||||
public function curry()
|
||||
{
|
||||
$f = fn($a, $b, $c) => $a + $b + $c;
|
||||
$curried = curry($f);
|
||||
|
||||
$this->assertIsCallable($curried);
|
||||
$this->assertIsCallable($curried(1));
|
||||
$this->assertIsCallable($curried(1)(2));
|
||||
$this->assertIsCallable($curried(1)(2));
|
||||
|
||||
$this->assertEquals(6, $curried(1)(2)(3));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function partial_application()
|
||||
{
|
||||
$f = fn($a, $b, $c) => $a + $b + $c;
|
||||
|
||||
$this->assertIsCallable(curry($f, 1));
|
||||
$this->assertIsCallable(curry($f, 1, 2));
|
||||
|
||||
// I would expect this:
|
||||
// $this->assertEquals(6, curry($f, 1, 2, 3));
|
||||
|
||||
// But we must add a () at the end, which I feel is a bug:
|
||||
$this->assertIsCallable(curry($f, 1, 2, 3));
|
||||
$this->assertEquals(6, curry($f, 1, 2, 3)());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user