diff options
author | michelou <michelou@epfl.ch> | 2008-02-15 14:49:53 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-02-15 14:49:53 +0000 |
commit | 787b0264db2b8f197d1688318a2790fcd037d9c8 (patch) | |
tree | d6fd618516d78fd308ccbfbe13256de30bdd8f0c /test/files/run | |
parent | 25fd82c6dd3014aa7993d069e8b53ad387d378c5 (diff) | |
download | scala-787b0264db2b8f197d1688318a2790fcd037d9c8.tar.gz scala-787b0264db2b8f197d1688318a2790fcd037d9c8.tar.bz2 scala-787b0264db2b8f197d1688318a2790fcd037d9c8.zip |
fixed #485 (IdentityHashMap)
Diffstat (limited to 'test/files/run')
-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 { |