diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/t0485.check | 6 | ||||
-rw-r--r-- | test/files/run/t0485.scala | 19 |
2 files changed, 20 insertions, 5 deletions
diff --git a/test/files/run/t0485.check b/test/files/run/t0485.check index 8e9f975de5..d370403f09 100644 --- a/test/files/run/t0485.check +++ b/test/files/run/t0485.check @@ -2,10 +2,6 @@ m1={20=30, 10=20} m2={10=20} m1 == m2 is false -m1={20=30, 10=20} -m2={10=20} -m1 == m2 is false - m1={10=20, 20=30} m2={10=20} m1 == m2 is false @@ -16,6 +12,8 @@ m1 == m2 is false java.lang.CloneNotSupportedException: The underlying map doesn't implement the Cloneable interface +m1.size > m2.size is true + m1=[20, 10] m2=[10] m1 == m2 is false diff --git a/test/files/run/t0485.scala b/test/files/run/t0485.scala index 8d00936ecb..def5a504df 100644 --- a/test/files/run/t0485.scala +++ b/test/files/run/t0485.scala @@ -21,11 +21,28 @@ object testMap { println(e); println() } } + def test1(m1: Map[Int, Int]) { + try { + m1.put(10, 20) + val m2 = m1.clone() + m1.put(20, 30) + println("m1.size > m2.size is "+ (m1.size > m2.size)) + println() + } + catch { + case e: Exception => + println(e); println() + } + } test(new HashMap[Int, Int]) - test(new IdentityHashMap[Int, Int]) test(new LinkedHashMap[Int, Int]) + // NB. class IdentityHashMap makes no guarantees as to the order + // of the map; in particular, it does not guarantee that the order + // will remain constant over time (see Java API docs). + //test1(new IdentityHashMap[Int, Int]) test(new TreeMap[Int, Int]) test(new WeakHashMap[Int, Int]) + test1(new IdentityHashMap[Int, Int]) } object testSet { |