-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit tests for Expression Language parsing
- Loading branch information
Showing
99 changed files
with
815 additions
and
0 deletions.
There are no files selected for viewing
212 changes: 212 additions & 0 deletions
212
...ienbrault/idea/symfony2plugin/tests/expressionLanguage/ExpressionLanguageParsingTest.java
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 |
---|---|---|
@@ -0,0 +1,212 @@ | ||
package fr.adrienbrault.idea.symfony2plugin.tests.expressionLanguage; | ||
|
||
import com.intellij.testFramework.ParsingTestCase; | ||
import fr.adrienbrault.idea.symfony2plugin.expressionLanguage.ExpressionLanguageParserDefinition; | ||
|
||
public class ExpressionLanguageParsingTest extends ParsingTestCase { | ||
|
||
public ExpressionLanguageParsingTest() { | ||
super("", "test", new ExpressionLanguageParserDefinition()); | ||
} | ||
|
||
public void testNotExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testUnaryMinus() { | ||
doTest(true); | ||
} | ||
|
||
public void testUnaryPlus() { | ||
doTest(true); | ||
} | ||
|
||
public void testDivExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testMulExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testModExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testPlusExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testMinusExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testRangeExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testIdenticalExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testNotIdenticalExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testEqExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testNotEqExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testGtExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testGteExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testLtExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testLteExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testNotInExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testInExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testMatchesExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testOrExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testAndExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testBitAndExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testBitOrExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testBitXorExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testExpExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testParenExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testNumberLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testNumberLiteralWithFraction() { | ||
doTest(true); | ||
} | ||
|
||
public void testStringDoubleQuoteLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testEmptyStringDoubleQuoteLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testStringSingleQuoteLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testEmptyStringSingleQuoteLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testTrueLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testTrueUppercaseLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testFalseLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testFalseUppercaseLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testNullLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testNullUppercaseLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testEmptyArrayLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testArrayLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testEmptyHashLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testHashLiteral() { | ||
doTest(true); | ||
} | ||
|
||
public void testFunctionCallWithoutArgs() { | ||
doTest(true); | ||
} | ||
|
||
public void testFunctionCallWithArgs() { | ||
doTest(true); | ||
} | ||
|
||
public void testMethodCallWithoutArgs() { | ||
doTest(true); | ||
} | ||
|
||
public void testMethodCallWithArgs() { | ||
doTest(true); | ||
} | ||
|
||
public void testTernaryExpr() { | ||
doTest(true); | ||
} | ||
|
||
public void testElvisExpr() { | ||
doTest(true); | ||
} | ||
|
||
@Override | ||
protected String getTestDataPath() { | ||
return "src/test/java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData"; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...t/java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/AndExpr.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
a && b |
11 changes: 11 additions & 0 deletions
11
...st/java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/AndExpr.txt
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Expression Language File | ||
ExpressionLanguageAndExprImpl(AND_EXPR) | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('a') | ||
PsiWhiteSpace(' ') | ||
PsiElement( ExpressionLanguageType.OP_AND)('&&') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('b') |
1 change: 1 addition & 0 deletions
1
...a/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/ArrayLiteral.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[1, a, "string", [], [1, 2, 3], {}, { foo: "Foo", bar: "Bar" }] |
61 changes: 61 additions & 0 deletions
61
...va/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/ArrayLiteral.txt
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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Expression Language File | ||
ExpressionLanguageArrayExprImpl(ARRAY_EXPR) | ||
PsiElement( ExpressionLanguageType.[)('[') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.number)('1') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('a') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.string)('"string"') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageArrayExprImpl(ARRAY_EXPR) | ||
PsiElement( ExpressionLanguageType.[)('[') | ||
PsiElement( ExpressionLanguageType.])(']') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageArrayExprImpl(ARRAY_EXPR) | ||
PsiElement( ExpressionLanguageType.[)('[') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.number)('1') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.number)('2') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.number)('3') | ||
PsiElement( ExpressionLanguageType.])(']') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageHashExprImpl(HASH_EXPR) | ||
PsiElement( ExpressionLanguageType.{)('{') | ||
PsiElement( ExpressionLanguageType.})('}') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageHashExprImpl(HASH_EXPR) | ||
PsiElement( ExpressionLanguageType.{)('{') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('foo') | ||
PsiElement( ExpressionLanguageType.syntax)(':') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.string)('"Foo"') | ||
PsiElement( ExpressionLanguageType.syntax)(',') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('bar') | ||
PsiElement( ExpressionLanguageType.syntax)(':') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.string)('"Bar"') | ||
PsiWhiteSpace(' ') | ||
PsiElement( ExpressionLanguageType.})('}') | ||
PsiElement( ExpressionLanguageType.])(']') |
1 change: 1 addition & 0 deletions
1
...ava/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/BitAndExpr.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
a & b |
11 changes: 11 additions & 0 deletions
11
...java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/BitAndExpr.txt
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Expression Language File | ||
ExpressionLanguageBitAndExprImpl(BIT_AND_EXPR) | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('a') | ||
PsiWhiteSpace(' ') | ||
PsiElement( ExpressionLanguageType.&)('&') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('b') |
1 change: 1 addition & 0 deletions
1
...java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/BitOrExpr.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
a | b |
11 changes: 11 additions & 0 deletions
11
.../java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/BitOrExpr.txt
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Expression Language File | ||
ExpressionLanguageBitOrExprImpl(BIT_OR_EXPR) | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('a') | ||
PsiWhiteSpace(' ') | ||
PsiElement( ExpressionLanguageType.|)('|') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('b') |
1 change: 1 addition & 0 deletions
1
...ava/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/BitXorExpr.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
a ^ b |
11 changes: 11 additions & 0 deletions
11
...java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/BitXorExpr.txt
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Expression Language File | ||
ExpressionLanguageBitXorExprImpl(BIT_XOR_EXPR) | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('a') | ||
PsiWhiteSpace(' ') | ||
PsiElement( ExpressionLanguageType.^)('^') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('b') |
1 change: 1 addition & 0 deletions
1
...t/java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/DivExpr.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
4 / 2 |
9 changes: 9 additions & 0 deletions
9
...st/java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/DivExpr.txt
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Expression Language File | ||
ExpressionLanguageDivExprImpl(DIV_EXPR) | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.number)('4') | ||
PsiWhiteSpace(' ') | ||
PsiElement( ExpressionLanguageType./)('/') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageLiteralExprImpl(LITERAL_EXPR) | ||
PsiElement( ExpressionLanguageType.number)('2') |
1 change: 1 addition & 0 deletions
1
...java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/ElvisExpr.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
a ?: b |
14 changes: 14 additions & 0 deletions
14
.../java/fr/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/ElvisExpr.txt
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Expression Language File | ||
ExpressionLanguageTernaryExprImpl(TERNARY_EXPR) | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('a') | ||
PsiWhiteSpace(' ') | ||
PsiElement( ExpressionLanguageType.syntax)('?') | ||
PsiErrorElement:<expr> expected, got ':' | ||
<empty list> | ||
PsiElement( ExpressionLanguageType.syntax)(':') | ||
PsiWhiteSpace(' ') | ||
ExpressionLanguageRefExprImpl(REF_EXPR) | ||
ExpressionLanguageIdentifierImpl(IDENTIFIER) | ||
PsiElement( ExpressionLanguageType.id)('b') |
1 change: 1 addition & 0 deletions
1
...adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/EmptyArrayLiteral.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
[] |
4 changes: 4 additions & 0 deletions
4
.../adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/EmptyArrayLiteral.txt
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Expression Language File | ||
ExpressionLanguageArrayExprImpl(ARRAY_EXPR) | ||
PsiElement( ExpressionLanguageType.[)('[') | ||
PsiElement( ExpressionLanguageType.])(']') |
1 change: 1 addition & 0 deletions
1
.../adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/EmptyHashLiteral.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
4 changes: 4 additions & 0 deletions
4
...r/adrienbrault/idea/symfony2plugin/tests/expressionLanguage/testData/EmptyHashLiteral.txt
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Expression Language File | ||
ExpressionLanguageHashExprImpl(HASH_EXPR) | ||
PsiElement( ExpressionLanguageType.{)('{') | ||
PsiElement( ExpressionLanguageType.})('}') |
1 change: 1 addition & 0 deletions
1
.../idea/symfony2plugin/tests/expressionLanguage/testData/EmptyStringDoubleQuoteLiteral.test
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
"" |
Oops, something went wrong.