Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compiler/test/dotty/tools/repl/TabcompleteTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TabcompleteTests extends ReplTest {

/** Returns the `(<instance completions>, <companion completions>)`*/
private[this] def tabComplete(src: String)(implicit state: State): List[String] =
completions(src.length, src, state).map(_.value)
completions(src.length, src, state).map(_.value).sorted
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might as well make completions return a sorted result.

Copy link
Contributor Author

@allanrenucci allanrenucci Jan 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JLine has its own mechanism to sort completions. So it doesn't matter if you sort the completion result in the first place


@Test def tabCompleteList = fromInitialState { implicit s =>
val comp = tabComplete("List.r")
Expand All @@ -17,7 +17,7 @@ class TabcompleteTests extends ReplTest {

@Test def tabCompleteListInstance = fromInitialState { implicit s =>
val comp = tabComplete("(null: List[Int]).sli")
assertEquals(List("slice", "sliding"), comp.distinct.sorted)
assertEquals(List("slice", "sliding"), comp.distinct)
}

@Test def tabCompleteModule = fromInitialState{ implicit s =>
Expand All @@ -36,7 +36,7 @@ class TabcompleteTests extends ReplTest {

fromInitialState { implicit state =>
val comp = tabComplete(src1)
assertEquals(List("map", "mapConserve"), comp.sorted)
assertEquals(List("map", "mapConserve"), comp)
state
}
.andThen { implicit state =>
Expand All @@ -58,7 +58,7 @@ class TabcompleteTests extends ReplTest {
}
.andThen { implicit state =>
val expected = List("comp1", "comp2", "comp3")
assertEquals(expected, tabComplete("(new Foo).comp").sorted)
assertEquals(expected, tabComplete("(new Foo).comp"))
}

@Test def completeFromPreviousState2 =
Expand Down