-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from xp-framework/refactor/omit-start-token
Omit start token from stream
- Loading branch information
Showing
3 changed files
with
10 additions
and
22 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 5 additions & 7 deletions
12
src/test/php/lang/ast/unittest/parse/StartTokensTest.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
<?php namespace lang\ast\unittest\parse; | ||
|
||
use lang\ast\nodes\{NamespaceDeclaration, Start}; | ||
use lang\ast\Errors; | ||
use lang\ast\nodes\NamespaceDeclaration; | ||
use unittest\{Assert, Test}; | ||
|
||
class StartTokensTest extends ParseTest { | ||
|
||
#[Test] | ||
public function php() { | ||
$this->assertParsed( | ||
[new Start('php', self::LINE), new NamespaceDeclaration('test', self::LINE)], | ||
[new NamespaceDeclaration('test', self::LINE)], | ||
'<?php namespace test;' | ||
); | ||
} | ||
|
||
#[Test] | ||
#[Test, Expect(class: Errors::class, withMessage: 'Unexpected syntax hh, expecting php in <?')] | ||
public function hack() { | ||
$this->assertParsed( | ||
[new Start('hh', self::LINE), new NamespaceDeclaration('test', self::LINE)], | ||
'<?hh namespace test;' | ||
); | ||
$this->parse('<?hh namespace test;')->tree(); | ||
} | ||
} |