packages/ztd-query-sqlite/tests/Unit/Sql/Lexing/ExpressionSpanTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Sql\Lexing;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\UsesClass;
9use PHPUnit\Framework\TestCase;
10use ZtdQuery\Platform\Sqlite\Sql\Lexing\ExpressionSpan;
11
12#[CoversClass(ExpressionSpan::class)]
13#[UsesClass(\ZtdQuery\Platform\Sqlite\Sql\Lexing\QuotedSpan::class)]
14final class ExpressionSpanTest extends TestCase
15{
16 public function testEndSkipsNestedAndQuotedDelimiters(): void
17 {
18 $scanner = new ExpressionSpan();
19 self::assertSame(11, $scanner->end('coalesce(1), next', 0));
20 self::assertSame(7, $scanner->end("'a,''b',next", 0));
21 self::assertSame(3, $scanner->end('abc)tail', 0));
22 self::assertSame(8, $scanner->end('abc)tail', 0, false));
23 self::assertSame(4, $scanner->end('xxxx', 4));
24 }
25
26}
27