From f848b69534d5fa8e203d4a316ce306d813faf9d0 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Wed, 9 Mar 2016 00:58:28 +0100 Subject: [PATCH] Add more test cases for self type and self variables. Per review request, add two more test cases for self variable (no self type). --- .../src/test/scala/xsbt/ExtractAPISpecification.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compile/interface/src/test/scala/xsbt/ExtractAPISpecification.scala b/compile/interface/src/test/scala/xsbt/ExtractAPISpecification.scala index d0a9f6908..839955689 100644 --- a/compile/interface/src/test/scala/xsbt/ExtractAPISpecification.scala +++ b/compile/interface/src/test/scala/xsbt/ExtractAPISpecification.scala @@ -90,15 +90,17 @@ class ExtractAPISpecification extends Specification { val srcC4 = "class C4 { thisC: X => }" val srcC5 = "class C5 extends AnyRef with X with Y { self: X with Y => }" val srcC6 = "class C6 extends AnyRef with X { self: X with Y => }" + val srcC7 = "class C7 { _ => }" + val srcC8 = "class C8 { self => }" val compilerForTesting = new ScalaCompilerForUnitTesting val apis = compilerForTesting.extractApisFromSrcs(reuseCompilerInstance = true)( - List(srcX, srcY, srcC1, srcC2, srcC3, srcC4, srcC5, srcC6) + List(srcX, srcY, srcC1, srcC2, srcC3, srcC4, srcC5, srcC6, srcC7, srcC8) ).map(x => collectFirstClass(x.definitions)) val emptyType = new EmptyType def hasSelfType(c: ClassLike): Boolean = c.selfType != emptyType val (withSelfType, withoutSelfType) = apis.partition(hasSelfType) withSelfType.map(_.name).toSet === Set("C3", "C4", "C5", "C6") - withoutSelfType.map(_.name).toSet === Set("X", "Y", "C1", "C2") + withoutSelfType.map(_.name).toSet === Set("X", "Y", "C1", "C2", "C7", "C8") } }