Skip to content

Commit

Permalink
Merge pull request #128 from VincentLanglet/moreTests
Browse files Browse the repository at this point in the history
🚨 Add tests
  • Loading branch information
VincentLanglet authored Apr 26, 2020
2 parents 2bc5cd9 + 69d54d2 commit 2aa90b3
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ Untouch +-/*%==:
{% if a - 2 == -4 %}{% endif %}
{{ a in -2..-3 }}
{{ "a_#{1 + 1}" }}

{{ 'array' starts with 'a' }}
{{ 'array' ends with 'a' }}
{{ 'array' matches 'a' }}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public function testSniff(): void
[22 => 6],
[33 => 10],
[33 => 10],
[35 => 13],
[35 => 13],
[36 => 13],
[36 => 13],
[37 => 13],
[37 => 13],
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ Untouch +-/*%==:
{% if a - 2 == -4 %}{% endif %}
{{ a in -2..-3 }}
{{ "a_#{1+1}" }}

{{ 'array' starts with 'a' }}
{{ 'array' ends with 'a' }}
{{ 'array' matches 'a' }}
50 changes: 50 additions & 0 deletions TwigCS/tests/Token/Tokenizer/TokenizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,56 @@ public function tokenizeDataProvider(): array
32 => Token::EOF_TYPE,
],
],
[
__DIR__.'/TokenizerTest5.twig',
[
0 => Token::BLOCK_START_TYPE,
1 => Token::WHITESPACE_TYPE,
2 => Token::BLOCK_TAG_TYPE,
3 => Token::WHITESPACE_TYPE,
4 => Token::NAME_TYPE,
5 => Token::WHITESPACE_TYPE,
6 => Token::OPERATOR_TYPE,
7 => Token::WHITESPACE_TYPE,
8 => Token::NAME_TYPE,
9 => Token::WHITESPACE_TYPE,
10 => Token::NAME_TYPE,
11 => Token::PUNCTUATION_TYPE,
12 => Token::NAME_TYPE,
13 => Token::PUNCTUATION_TYPE,
14 => Token::WHITESPACE_TYPE,
15 => Token::BLOCK_END_TYPE,
16 => Token::BLOCK_START_TYPE,
17 => Token::WHITESPACE_TYPE,
18 => Token::BLOCK_TAG_TYPE,
19 => Token::WHITESPACE_TYPE,
20 => Token::BLOCK_END_TYPE,
21 => Token::EOL_TYPE,
22 => Token::BLOCK_START_TYPE,
23 => Token::WHITESPACE_TYPE,
24 => Token::BLOCK_TAG_TYPE,
25 => Token::WHITESPACE_TYPE,
26 => Token::NAME_TYPE,
27 => Token::WHITESPACE_TYPE,
28 => Token::OPERATOR_TYPE,
29 => Token::WHITESPACE_TYPE,
30 => Token::NAME_TYPE,
31 => Token::WHITESPACE_TYPE,
32 => Token::NAME_TYPE,
33 => Token::PUNCTUATION_TYPE,
34 => Token::NAME_TYPE,
35 => Token::PUNCTUATION_TYPE,
36 => Token::WHITESPACE_TYPE,
37 => Token::BLOCK_END_TYPE,
38 => Token::BLOCK_START_TYPE,
39 => Token::WHITESPACE_TYPE,
40 => Token::BLOCK_TAG_TYPE,
41 => Token::WHITESPACE_TYPE,
42 => Token::BLOCK_END_TYPE,
43 => Token::EOL_TYPE,
44 => Token::EOF_TYPE,
],
],
];
}
}
2 changes: 2 additions & 0 deletions TwigCS/tests/Token/Tokenizer/TokenizerTest5.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{% if foo is same as(bar) %}{% endif %}
{% if foo is divisible by(bar) %}{% endif %}

0 comments on commit 2aa90b3

Please sign in to comment.