Skip to content

Commit

Permalink
Improve test for "names in type tree"
Browse files Browse the repository at this point in the history
The previous test was flaky because there was no guarantee that the
prefix of `BB` was correctly catched by the type traverser (the name of
`a` could have been recognised in the type of `foo` and not in `bar`).

The following PR makes sure that the prefix `c` is also captured.
  • Loading branch information
jvican committed Feb 26, 2017
1 parent 2f1002f commit 83bcf50
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@ class ExtractUsedNamesSpecification extends UnitSpec {
| class C { class D }
| }
| class B[T]
|}
|package c {
| class BB
|}""".stripMargin
|}
|
|""".stripMargin
val srcB = """|package b {
| abstract class X {
| def foo: a.A#C#D
| def bar: a.B[a.BB]
| def bar: a.B[c.BB]
| }
|}""".stripMargin
val compilerForTesting = new ScalaCompilerForUnitTesting(nameHashing = true)
val usedNames = compilerForTesting.extractUsedNamesFromSrc(srcA, srcB)
val expectedNames = standardNames ++ Set("a", "A", "B", "C", "D", "b", "X", "BB")
val expectedNames = standardNames ++ Set("a", "c", "A", "B", "C", "D", "b", "X", "BB")
assert(usedNames("b.X") === expectedNames)
}

Expand Down

0 comments on commit 83bcf50

Please sign in to comment.