diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-09-14 17:07:23 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-09-14 17:07:23 +0200 |
commit | 12053fa4d55497fc4df06afd67ba3762019969c3 (patch) | |
tree | 0cbab1dee0784793d2ab09124a0103412e813072 /tests/run/t2813.2.scala | |
parent | 91f992c8af3e61a76bd862ad43b9abef9a6c3403 (diff) | |
download | dotty-12053fa4d55497fc4df06afd67ba3762019969c3.tar.gz dotty-12053fa4d55497fc4df06afd67ba3762019969c3.tar.bz2 dotty-12053fa4d55497fc4df06afd67ba3762019969c3.zip |
Enable more tests that pass
Diffstat (limited to 'tests/run/t2813.2.scala')
-rw-r--r-- | tests/run/t2813.2.scala | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/run/t2813.2.scala b/tests/run/t2813.2.scala new file mode 100644 index 000000000..d228eed90 --- /dev/null +++ b/tests/run/t2813.2.scala @@ -0,0 +1,39 @@ +import java.util.LinkedList +import collection.JavaConversions._ + +object Test extends dotty.runtime.LegacyApp { + def assertListEquals[A](expected: List[A], actual: Seq[A]): Unit = { + assert(expected.sameElements(actual), + "Expected list to contain " + expected.mkString("[", ", ", "]") + + ", but was " + actual.mkString("[", ", ", "]")) + } + + def addAllOfNonCollectionWrapperAtZeroOnEmptyLinkedList(): Unit = { + val l = new LinkedList[Int] + l.addAll(0, List(1, 2)) + assertListEquals(List(1, 2), l) + } + + def addAllOfNonCollectionWrapperAtZeroOnLinkedList(): Unit = { + val l = new LinkedList[Int] += 1 += 2 + l.addAll(0, List(10, 11)) + assertListEquals((List(10, 11, 1, 2)), l) + } + + def addAllOfCollectionWrapperAtZeroOnLinkedList(): Unit = { + val l = new LinkedList[Int] += 1 += 2 + l.addAll(0, new LinkedList[Int] += 10 += 11) + assertListEquals((List(10, 11, 1, 2)), l) + } + + def addAllOfCollectionWrapperAtZeroOnEmptyLinkedList(): Unit = { + val l = new LinkedList[Int] + l.addAll(0, new LinkedList[Int] += 10 += 11) + assertListEquals((List(10, 11)), l) + } + + addAllOfNonCollectionWrapperAtZeroOnEmptyLinkedList + addAllOfNonCollectionWrapperAtZeroOnLinkedList + addAllOfCollectionWrapperAtZeroOnEmptyLinkedList + addAllOfCollectionWrapperAtZeroOnLinkedList +} |