Add pending test for #2324 (name hashes of private members)

Add a pending test that shows a bug in calculation of name hashes.
By design, only non-private members should contribute to name hashes. The
test shows that name hashes are calcuclated for strictly private members
too.
This commit is contained in:
Grzegorz Kossakowski 2015-12-18 14:05:00 -08:00
parent d3cb46951b
commit ae2ddab009
1 changed files with 15 additions and 1 deletions

View File

@ -255,7 +255,7 @@ class NameHashingSpecification extends Specification {
/**
* Checks that private members are NOT included in the hash of the public API of classes.
*/
"private members in classes" in {
"private members in classes are not included in the api hash" in {
/* class Foo { private val x } */
val classFoo1 =
simpleClass("Foo",
@ -273,6 +273,20 @@ class NameHashingSpecification extends Specification {
}
/**
* Checks that private members do NOT contribute to name hashes.
* Test for https://github.com/sbt/sbt/issues/2324
*/
"private members in classes do not contribute to name hashes" in {
/* class Foo { private val x } */
val classFoo =
simpleClass("Foo",
simpleStructure(new Val(emptyType, "x", privateAccess, defaultModifiers, Array.empty)))
val nameHashes = nameHashesForClass(classFoo)
// make sure there's no name hash for the private member "x"
Seq("Foo") === nameHashes.regularMembers.map(_.name).toSeq
}.pendingUntilFixed("The NameHashing calculates name hashes of all members")
private def assertNameHashEqualForRegularName(name: String, nameHashes1: _internalOnly_NameHashes,
nameHashes2: _internalOnly_NameHashes) = {
val nameHash1 = nameHashForRegularName(nameHashes1, name)