Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lwronski committed Nov 24, 2021
1 parent d1243d7 commit b81f687
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object Bash {
}

private def escape(s: String): String =
s.replace("\"", "\\\"").replace("`", "\\`").split("\\r?\\n").headOption.getOrElse("")
s.replace("\"", "\\\"").replace("`", "\\`").split("\r?\n").headOption.getOrElse("")
def print(items: Seq[CompletionItem]): String = {
val newLine = System.lineSeparator()
val b = new StringBuilder
Expand Down
2 changes: 1 addition & 1 deletion core/shared/src/main/scala/caseapp/core/complete/Zsh.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Zsh {
res
}
private def escape(s: String): String =
s.replace("'", "\\'").replace("`", "\\`").split("\\r?\\n").headOption.getOrElse("")
s.replace("'", "\\'").replace("`", "\\`").split("\r?\n").headOption.getOrElse("")
private def defs(item: CompletionItem): Seq[String] = {
val (options, arguments) = item.values.partition(_.startsWith("-"))
val optionsOutput =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ object CompletionDefinitions {
case class BackTickOptions(
@HelpMessage(
"""A pattern with backtick `--`
|with multiline
|""".stripMargin
|with multiline""".stripMargin
) backtick: String = "",
@Name("d") count: Int = 0
)
Expand Down
4 changes: 2 additions & 2 deletions tests/shared/src/test/scala/caseapp/CompletionTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ object CompletionTests extends TestSuite {
test("bash") {
val res = Prog.complete(Seq("back-tick", "-"), 1)
val expected = List(
CompletionItem("--backtick", Some("A pattern with backtick `--`"), Nil),
CompletionItem("--backtick", Some("A pattern with backtick `--`\nwith multiline"), Nil),
CompletionItem("--count", None, List("-d"))
)
assert(res == expected)
Expand All @@ -158,7 +158,7 @@ object CompletionTests extends TestSuite {
test("zsh") {
val res = Prog.complete(Seq("back-tick", "-"), 1)
val expected = List(
CompletionItem("--backtick", Some("A pattern with backtick `--`"), Nil),
CompletionItem("--backtick", Some("A pattern with backtick `--`\nwith multiline"), Nil),
CompletionItem("--count", None, List("-d"))
)
assert(res == expected)
Expand Down

0 comments on commit b81f687

Please sign in to comment.