-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
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
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,34 @@ | ||
package features.glue | ||
|
||
import com.intellij.openapi.application.runReadAction | ||
import com.jetbrains.python.psi.PyRecursiveElementVisitor | ||
import com.jetbrains.python.psi.PyReferenceExpression | ||
import com.jetbrains.snakecharm.stringLanguage.lang.psi.SmkSLSubscriptionKeyReferenceExpression | ||
import io.cucumber.java.en.When | ||
|
||
class OnetimeUsedSteps { | ||
@When("^validate issue 380$") | ||
fun validateIssue380() { | ||
runReadAction { | ||
val psiElement = SnakemakeWorld.fixture().elementAtCaret | ||
require(psiElement is SmkSLSubscriptionKeyReferenceExpression) { | ||
"Actual class: ${psiElement.javaClass.simpleName}" | ||
} | ||
require(psiElement.text.equals("proportion")) { | ||
"Actual text: ${psiElement.text}" | ||
} | ||
var counter = 0 | ||
val visitor = object : PyRecursiveElementVisitor() { | ||
override fun visitPyReferenceExpression(node: PyReferenceExpression) { | ||
counter++ | ||
node.qualifier?.accept(this) | ||
} | ||
} | ||
psiElement.accept(visitor) | ||
// Assert no SOE, i.e. stack not deep: | ||
assert(counter < 5) { | ||
"Actual counter: $counter" | ||
} | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/resources/features/stringLanguage/issue380.feature
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,13 @@ | ||
Feature: SOE, issue 380 | ||
Scenario: Foo | ||
Given a snakemake project | ||
Given I open a file "foo.smk" with text | ||
""" | ||
def foo(): | ||
rule: | ||
shell: "{config[methtool][proportion]}" | ||
pass | ||
""" | ||
When I put the caret after propo | ||
Then I expect language injection on "{config[methtool][proportion]}" | ||
And validate issue 380 |