packages/lemon-parser/tests/Unit/Ast/Declaration/DestructorTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Ast\Declaration;
6
7use LemonParser\Ast\Declaration\ArgumentForm;
8use LemonParser\Ast\Declaration\Destructor;
9use LemonParser\Ast\Location;
10use LemonParser\Ast\Symbol;
11use PHPUnit\Framework\Attributes\CoversClass;
12use PHPUnit\Framework\Attributes\Small;
13use PHPUnit\Framework\Attributes\UsesClass;
14use PHPUnit\Framework\TestCase;
15
16#[CoversClass(Destructor::class)]
17#[UsesClass(Location::class)]
18#[UsesClass(ArgumentForm::class)]
19#[UsesClass(Symbol::class)]
20#[Small]
21final class DestructorTest extends TestCase
22{
23 public function testLocation(): void
24 {
25 $declaration = new Destructor(new Symbol('expr', new Location(3, 13)), ' free($$); ', ArgumentForm::Code, new Location(3, 1));
26
27 self::assertSame('3:1', (string) $declaration->location());
28 self::assertSame('expr', $declaration->symbol->name);
29 self::assertSame(' free($$); ', $declaration->value);
30 self::assertSame(ArgumentForm::Code, $declaration->form);
31 }
32}
33