Skip to content

Commit

Permalink
tests: test for #558 added
Browse files Browse the repository at this point in the history
  • Loading branch information
iromeo committed Nov 5, 2024
1 parent 4bee539 commit 486907c
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/kotlin/features/glue/ActionsSteps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ import kotlin.test.*


class ActionsSteps {
@When("^I type multiline text '(.+)' at the caret position$")
fun iTypeTextAtCaret(text: String) {
val application = ApplicationManager.getApplication()
application.invokeAndWait({
SnakemakeWorld.fixture().type(
text.replace("\\n\\r", "\n").replace("\\n", "\n")
)
}, ModalityState.nonModal())
}

@When("^I expect inspection (error|warning|info|TYPO|weak warning) on <([^>]+)> with message$")
fun iExpectInspectionOn(level: String, signature: String, message: String) {
iExpectInspectionOnIn(level, signature, signature, message)
Expand Down
9 changes: 9 additions & 0 deletions src/test/kotlin/features/glue/FilesSteps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@ class FilesSteps {
createAndAddFile(name, text)
}

@Given("^I expect text in current file:$")
fun iExpectTextInCurrentFile(text: String) {
ApplicationManager.getApplication().invokeAndWait({
val actualText = SnakemakeWorld.fixture().editor.document.text
assertEquals(text, actualText)
})
}


@Given("snakemake framework api yaml descriptor is$")
fun snakemakeFrameworkApiInfoContent(text: String) {
ApplicationManager.getApplication().invokeAndWait({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Feature: Check indent after newline symbol typing
Scenario: New line in section in the middle of file
Given a snakemake project
Given I open a file "foo.smk" with text
"""
rule foo:
input: "foo/{sample}"
# formatter hack
"""
And I put the caret after "foo/{sample}"
When I type multiline text '\noutput: "boo/{sample}"' at the caret position
Then I expect text in current file:
"""
rule foo:
input: "foo/{sample}"
output: "boo/{sample}"
# formatter hack
"""

@ignore
Scenario: New line in section in the end of file
Given a snakemake project
Given I open a file "foo.smk" with text
"""
rule foo:
input: "foo/{sample}"
"""
And I put the caret after "foo/{sample}"
When I type multiline text '\noutput: "boo/{sample}"' at the caret position
Then I expect text in current file:
"""
rule foo:
input: "foo/{sample}"
output: "boo/{sample}"
"""

0 comments on commit 486907c

Please sign in to comment.