Files
wp-agentic-writer/vendor/parsica-php/parsica/tests/ParseResult/AppendTest.php
Dwindi Ramadhana 690991c526 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.
2026-06-17 05:27:58 +07:00

54 lines
2.1 KiB
PHP

<?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\ParseResult;
use PHPUnit\Framework\TestCase;
use Parsica\Parsica\Internal\Fail;
use Parsica\Parsica\Internal\Succeed;
use Parsica\Parsica\PHPUnit\ParserAssertions;
use Parsica\Parsica\StringStream;
final class AppendTest extends TestCase
{
use ParserAssertions;
/** @test */
public function append_strings()
{
$remainder = new StringStream("");
$succeed1 = new Succeed("Parsed1", new StringStream("Remain1"));
$succeed2 = new Succeed("Parsed2", new StringStream("Remain2"));
$fail1 = new Fail("Expected1", new StringStream("Got1"));
$fail2 = new Fail("Expected2", new StringStream("Got2"));
$this->assertStrictlyEquals(new Succeed("Parsed1Parsed2", new StringStream("Remain2")), $succeed1->append($succeed2));
$this->assertStrictlyEquals(new Fail("Expected1", new StringStream("Got1")), $succeed1->append($fail1));
$this->assertStrictlyEquals(new Fail("Expected1", new StringStream("Got1")), $fail1->append($succeed2));
$this->assertStrictlyEquals(new Fail("Expected1", new StringStream("Got1")), $fail1->append($fail2));
}
/** @test */
public function append_with_null()
{
$null1 = new Succeed(null, new StringStream("Remain Null 1"));
$null2 = new Succeed(null, new StringStream("Remain Null 2"));
$string = new Succeed("String", new StringStream("Remain String"));
$first = $string->append($null1);
$this->assertStrictlyEquals(new Succeed("String", new StringStream("Remain Null 1")), $first);
$second = $null1->append($string);
$this->assertStrictlyEquals(new Succeed("String", new StringStream("Remain String")), $second);
$both = $null1->append($null2);
$this->assertStrictlyEquals(new Succeed(null, new StringStream("Remain Null 2")), $both);
}
}