Skip to content

Commit

Permalink
improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Mar 10, 2022
1 parent d3868db commit 0cf8118
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/Neon/Encoder.nodes.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ $node = $encoder->valueToNode($input);

Assert::matchFile(
__DIR__ . '/fixtures/Encoder.nodes.txt',
Dumper::toText($node, [Dumper::HASH => false])
Dumper::toText($node, [Dumper::HASH => false, Dumper::DEPTH => 20])
);
2 changes: 1 addition & 1 deletion tests/Neon/Parser.nodes.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ $traverser->traverse($node, function (Node $node) use ($stream) {

Assert::matchFile(
__DIR__ . '/fixtures/Parser.nodes.txt',
Dumper::toText($node, [Dumper::HASH => false])
Dumper::toText($node, [Dumper::HASH => false, Dumper::DEPTH => 20])
);
26 changes: 24 additions & 2 deletions tests/Neon/fixtures/Encoder.nodes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,30 @@ Nette\Neon\Node\InlineArrayNode
| | | | | | startLine: null
| | | | | | endLine: null
| | | | | attributes: array (2)
| | | | | | 0 => Nette\Neon\Node\ArrayItemNode ...
| | | | | | 1 => Nette\Neon\Node\ArrayItemNode ...
| | | | | | 0 => Nette\Neon\Node\ArrayItemNode
| | | | | | | key: null
| | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | value: 'a'
| | | | | | | | startTokenPos: null
| | | | | | | | endTokenPos: null
| | | | | | | | startLine: null
| | | | | | | | endLine: null
| | | | | | | startTokenPos: null
| | | | | | | endTokenPos: null
| | | | | | | startLine: null
| | | | | | | endLine: null
| | | | | | 1 => Nette\Neon\Node\ArrayItemNode
| | | | | | | key: null
| | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | value: 'b'
| | | | | | | | startTokenPos: null
| | | | | | | | endTokenPos: null
| | | | | | | | startLine: null
| | | | | | | | endLine: null
| | | | | | | startTokenPos: null
| | | | | | | endTokenPos: null
| | | | | | | startLine: null
| | | | | | | endLine: null
| | | | | startTokenPos: null
| | | | | endTokenPos: null
| | | | | startLine: null
Expand Down
200 changes: 195 additions & 5 deletions tests/Neon/fixtures/Parser.nodes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,69 @@ Nette\Neon\Node\BlockArrayNode
| | | | | | | \t \t l, m:\n
| | | | | | | \t n]'
| | | | | | bracket: '['
| | | | | | items: array (4) ...
| | | | | | items: array (4)
| | | | | | | 0 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | code: 'k'
| | | | | | | | key: null
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'k'
| | | | | | | | | value: 'k'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 7
| | | | | | | | | endLine: 7
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 7
| | | | | | | | endLine: 7
| | | | | | | 1 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | code: 'l'
| | | | | | | | key: null
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'l'
| | | | | | | | | value: 'l'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 8
| | | | | | | | | endLine: 8
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 8
| | | | | | | | endLine: 8
| | | | | | | 2 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | code: 'm:\n'
| | | | | | | | key: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'm'
| | | | | | | | | value: 'm'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 8
| | | | | | | | | endLine: 8
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: '\n'
| | | | | | | | | value: null
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 8
| | | | | | | | | endLine: 9
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 8
| | | | | | | | endLine: 9
| | | | | | | 3 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | code: 'n'
| | | | | | | | key: null
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'n'
| | | | | | | | | value: 'n'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 9
| | | | | | | | | endLine: 9
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 9
| | | | | | | | endLine: 9
| | | | | | startTokenPos: unset
| | | | | | endTokenPos: unset
| | | | | | startLine: 7
Expand Down Expand Up @@ -141,7 +203,47 @@ Nette\Neon\Node\BlockArrayNode
| | | | | | | 'a: 1\n
| | | | | | | \t \t b: 2'
| | | | | | indentation: '\t '
| | | | | | items: array (2) ...
| | | | | | items: array (2)
| | | | | | | 0 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | code: 'a: 1'
| | | | | | | | key: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'a'
| | | | | | | | | value: 'a'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 12
| | | | | | | | | endLine: 12
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: '1'
| | | | | | | | | value: 1
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 12
| | | | | | | | | endLine: 12
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 12
| | | | | | | | endLine: 12
| | | | | | | 1 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | code: 'b: 2'
| | | | | | | | key: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'b'
| | | | | | | | | value: 'b'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 13
| | | | | | | | | endLine: 13
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: '2'
| | | | | | | | | value: 2
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 13
| | | | | | | | | endLine: 13
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 13
| | | | | | | | endLine: 13
| | | | | | startTokenPos: unset
| | | | | | endTokenPos: unset
| | | | | | startLine: 12
Expand Down Expand Up @@ -181,8 +283,34 @@ Nette\Neon\Node\BlockArrayNode
| | | | | key: null
| | | | | value: Nette\Neon\Node\EntityNode
| | | | | | code: 'entity(a: 1)'
| | | | | | value: Nette\Neon\Node\LiteralNode ...
| | | | | | attributes: array (1) ...
| | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | code: 'entity'
| | | | | | | value: 'entity'
| | | | | | | startTokenPos: unset
| | | | | | | endTokenPos: unset
| | | | | | | startLine: 15
| | | | | | | endLine: 15
| | | | | | attributes: array (1)
| | | | | | | 0 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | code: 'a: 1'
| | | | | | | | key: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'a'
| | | | | | | | | value: 'a'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 15
| | | | | | | | | endLine: 15
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: '1'
| | | | | | | | | value: 1
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 15
| | | | | | | | | endLine: 15
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 15
| | | | | | | | endLine: 15
| | | | | | startTokenPos: unset
| | | | | | endTokenPos: unset
| | | | | | startLine: 15
Expand All @@ -196,7 +324,69 @@ Nette\Neon\Node\BlockArrayNode
| | | | | key: null
| | | | | value: Nette\Neon\Node\EntityChainNode
| | | | | | code: 'entity(a: 1)foo()bar'
| | | | | | chain: array (3) ...
| | | | | | chain: array (3)
| | | | | | | 0 => Nette\Neon\Node\EntityNode
| | | | | | | | code: 'entity(a: 1)'
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'entity'
| | | | | | | | | value: 'entity'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 16
| | | | | | | | | endLine: 16
| | | | | | | | attributes: array (1)
| | | | | | | | | 0 => Nette\Neon\Node\ArrayItemNode
| | | | | | | | | | code: 'a: 1'
| | | | | | | | | | key: Nette\Neon\Node\LiteralNode
| | | | | | | | | | | code: 'a'
| | | | | | | | | | | value: 'a'
| | | | | | | | | | | startTokenPos: unset
| | | | | | | | | | | endTokenPos: unset
| | | | | | | | | | | startLine: 16
| | | | | | | | | | | endLine: 16
| | | | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | | | code: '1'
| | | | | | | | | | | value: 1
| | | | | | | | | | | startTokenPos: unset
| | | | | | | | | | | endTokenPos: unset
| | | | | | | | | | | startLine: 16
| | | | | | | | | | | endLine: 16
| | | | | | | | | | startTokenPos: unset
| | | | | | | | | | endTokenPos: unset
| | | | | | | | | | startLine: 16
| | | | | | | | | | endLine: 16
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 16
| | | | | | | | endLine: 16
| | | | | | | 1 => Nette\Neon\Node\EntityNode
| | | | | | | | code: 'foo()'
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'foo'
| | | | | | | | | value: 'foo'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 16
| | | | | | | | | endLine: 16
| | | | | | | | attributes: array (0)
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 16
| | | | | | | | endLine: 16
| | | | | | | 2 => Nette\Neon\Node\EntityNode
| | | | | | | | code: 'bar'
| | | | | | | | value: Nette\Neon\Node\LiteralNode
| | | | | | | | | code: 'bar'
| | | | | | | | | value: 'bar'
| | | | | | | | | startTokenPos: unset
| | | | | | | | | endTokenPos: unset
| | | | | | | | | startLine: 16
| | | | | | | | | endLine: 16
| | | | | | | | attributes: array (0)
| | | | | | | | startTokenPos: unset
| | | | | | | | endTokenPos: unset
| | | | | | | | startLine: 16
| | | | | | | | endLine: 16
| | | | | | startTokenPos: unset
| | | | | | endTokenPos: unset
| | | | | | startLine: 16
Expand Down

0 comments on commit 0cf8118

Please sign in to comment.