Skip to content
Permalink
Browse files

Switch to Ammonite nightly to get completions back in 2.13

  • Loading branch information...
alexarchambault committed Jun 14, 2019
1 parent 34c404a commit c955438aa9c1b0a49c2c0e01bb28d34d6dd9f99c
@@ -158,60 +158,56 @@ object ScalaInterpreterTests extends TestSuite {

"completion" - {

// disabled in 2.13 until we can use https://github.com/lihaoyi/Ammonite/pull/973
if (!scala.util.Properties.versionNumberString.startsWith("2.13.")) {

// Completions are tested in more detail in Ammonite too.
// Compared to it, we filter out stuff that contains '$', and pay
// particular attention to the position parameter that it returns
// (the Jupyter UI will replace some of the user code with a completion
// using that parameter).

* - {
val code = "repl.la"
val expectedRes = Completion(5, 7, Seq("lastException"))
val res = interpreter.complete(code, code.length)
assert(res == expectedRes)
}
// Completions are tested in more detail in Ammonite too.
// Compared to it, we filter out stuff that contains '$', and pay
// particular attention to the position parameter that it returns
// (the Jupyter UI will replace some of the user code with a completion
// using that parameter).

* - {
val code = "repl.la"
val expectedRes = Completion(5, 7, Seq("lastException"))
val res = interpreter.complete(code, code.length)
assert(res == expectedRes)
}

* - {
val code = "Lis"
val expectedRes = Completion(0, 3, Seq("List"))
val alternativeExpectedRes = Completion(0, 3, Seq("scala.List"))
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
val alternativeRes = res0.copy(
completions = res0.completions.filter(alternativeExpectedRes.completions.toSet)
)
assert(res == expectedRes || alternativeRes == alternativeExpectedRes)
}
* - {
val code = "Lis"
val expectedRes = Completion(0, 3, Seq("List"))
val alternativeExpectedRes = Completion(0, 3, Seq("scala.List"))
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
val alternativeRes = res0.copy(
completions = res0.completions.filter(alternativeExpectedRes.completions.toSet)
)
assert(res == expectedRes || alternativeRes == alternativeExpectedRes)
}

* - {
val code = "HashM"

val extraCompletions =
if (isScala211 || isScala212)
Seq("scala.collection.parallel.immutable.HashMapCombiner")
else
Nil

val expectedRes = Completion(
0,
5,
Seq(
"java.util.HashMap",
"scala.collection.immutable.HashMap",
"scala.collection.mutable.HashMap"
) ++ extraCompletions
)
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
assert(res == expectedRes)
}
* - {
val code = "HashM"

val extraCompletions =
if (isScala211 || isScala212)
Seq("scala.collection.parallel.immutable.HashMapCombiner")
else
Nil

val expectedRes = Completion(
0,
5,
Seq(
"java.util.HashMap",
"scala.collection.immutable.HashMap",
"scala.collection.mutable.HashMap"
) ++ extraCompletions
)
val res0 = interpreter.complete(code, code.length)
val res = res0.copy(
completions = res0.completions.filter(expectedRes.completions.toSet)
)
assert(res == expectedRes)
}

}
@@ -9,7 +9,7 @@ object Deps {
def ammonite = setting {
val sv = scalaVersion.value
if (sv.startsWith("2.11.")) "1.6.7"
else "1.6.8"
else "1.6.8-1-c7a656e"
}
def caseApp = "2.0.0-M9"
}

0 comments on commit c955438

Please sign in to comment.
You can’t perform that action at this time.