Skip to content

Commit

Permalink
Added test for issue #12
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Jul 9, 2020
1 parent 9f7f96d commit 94178a3
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/kotlin/ZephirParserTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ import com.zephir.lang.core.parser.ZephirParserDefinition
class ZephirParserTest : ParsingTestCase("parser", "zep", ZephirParserDefinition()) {
fun testHelloWorld() = doTest(true)

fun testIssue12() = doTest(true)

override fun getTestDataPath() = "src/test/testData"
}
98 changes: 98 additions & 0 deletions src/test/testData/parser/Issue12.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
Zephir File
ZephirNamespaceStatementImpl(NAMESPACE_STATEMENT)
PsiElement(namespace)('namespace')
PsiWhiteSpace(' ')
ZephirComplexIdImpl(COMPLEX_ID)
ZephirIdImpl(ID)
PsiElement(identifier)('Zephir')
PsiElement(;)(';')
PsiWhiteSpace('\n\n')
ZephirClassDefinitionImpl(CLASS_DEFINITION)
PsiElement(class)('class')
PsiWhiteSpace(' ')
ZephirIdImpl(ID)
PsiElement(identifier)('Issue12')
PsiWhiteSpace(' ')
ZephirClassBodyImpl(CLASS_BODY)
PsiElement({)('{')
PsiWhiteSpace('\n ')
ZephirMethodDefinitionImpl(METHOD_DEFINITION)
ZephirVisibilityImpl(VISIBILITY)
PsiElement(public)('public')
PsiWhiteSpace(' ')
PsiElement(function)('function')
PsiWhiteSpace(' ')
ZephirIdImpl(ID)
PsiElement(identifier)('test')
PsiElement(()('(')
PsiElement())(')')
PsiWhiteSpace(' ')
ZephirMethodBodyImpl(METHOD_BODY)
ZephirCodeBlockImpl(CODE_BLOCK)
PsiElement({)('{')
PsiWhiteSpace('\n ')
ZephirCodeImpl(CODE)
ZephirLetStatementImpl(LET_STATEMENT)
PsiElement(let)('let')
PsiWhiteSpace(' ')
ZephirAssignmentExprImpl(ASSIGNMENT_EXPR)
ZephirVariableImpl(VARIABLE)
ZephirComplexIdImpl(COMPLEX_ID)
ZephirIdImpl(ID)
PsiElement(identifier)('sql')
PsiWhiteSpace(' ')
ZephirAssignmentOperatorImpl(ASSIGNMENT_OPERATOR)
PsiElement(=)('=')
PsiWhiteSpace(' ')
ZephirCallExprImpl(CALL_EXPR)
ZephirLiteralExprImpl(LITERAL_EXPR)
ZephirVariableImpl(VARIABLE)
ZephirComplexIdImpl(COMPLEX_ID)
ZephirIdImpl(ID)
PsiElement(identifier)('preg_replace')
PsiElement(()('(')
PsiWhiteSpace('\n ')
ZephirCallArgumentsImpl(CALL_ARGUMENTS)
ZephirLiteralExprImpl(LITERAL_EXPR)
ZephirScalarImpl(SCALAR)
PsiElement(string)('"/\?/"')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
ZephirCallExprImpl(CALL_EXPR)
ZephirLiteralExprImpl(LITERAL_EXPR)
ZephirVariableImpl(VARIABLE)
ZephirComplexIdImpl(COMPLEX_ID)
ZephirIdImpl(ID)
PsiElement(identifier)('this')
PsiElement(->)('->')
ZephirVariableImpl(VARIABLE)
ZephirComplexIdImpl(COMPLEX_ID)
ZephirIdImpl(ID)
PsiElement(identifier)('val')
PsiElement(()('(')
ZephirCallArgumentsImpl(CALL_ARGUMENTS)
ZephirLiteralExprImpl(LITERAL_EXPR)
ZephirVariableImpl(VARIABLE)
ZephirComplexIdImpl(COMPLEX_ID)
ZephirIdImpl(ID)
PsiElement(identifier)('value')
PsiElement())(')')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
ZephirLiteralExprImpl(LITERAL_EXPR)
ZephirVariableImpl(VARIABLE)
ZephirComplexIdImpl(COMPLEX_ID)
ZephirIdImpl(ID)
PsiElement(identifier)('sql')
PsiElement(,)(',')
PsiWhiteSpace('\n ')
ZephirLiteralExprImpl(LITERAL_EXPR)
ZephirScalarImpl(SCALAR)
PsiElement(integer)('1')
PsiWhiteSpace('\n ')
PsiElement())(')')
PsiElement(;)(';')
PsiWhiteSpace('\n ')
PsiElement(})('}')
PsiWhiteSpace('\n')
PsiElement(})('}')
13 changes: 13 additions & 0 deletions src/test/testData/parser/Issue12.zep
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace Zephir;

class Issue12 {
public function test() {
let sql = preg_replace(
"/\?/",
this->val(value),
sql,
1
);
}
}

0 comments on commit 94178a3

Please sign in to comment.