packages/lemon-parser/tests/Unit/Ast/CodeBlockTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Ast;
6
7use LemonParser\Ast\CodeBlock;
8use LemonParser\Ast\Location;
9use PHPUnit\Framework\Attributes\CoversClass;
10use PHPUnit\Framework\Attributes\Small;
11use PHPUnit\Framework\Attributes\UsesClass;
12use PHPUnit\Framework\TestCase;
13
14#[CoversClass(CodeBlock::class)]
15#[UsesClass(Location::class)]
16#[Small]
17final class CodeBlockTest extends TestCase
18{
19    public function testCode(): void
20    {
21        $block = new CodeBlock(' A = B; ', new Location(3, 30));
22
23        self::assertSame(' A = B; ', $block->code);
24        self::assertSame('3:30', (string) $block->location);
25    }
26}
27