diff options
author | James Iry <jamesiry@gmail.com> | 2013-05-28 10:09:08 -0700 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-05-28 10:09:08 -0700 |
commit | 96e67c22b3b7bdf54081ba8a194a68e8b7b4740c (patch) | |
tree | 45c409c06bdc9f86f942598208103e6de15bf608 /test/files/run/list_map.scala | |
parent | 6889cffd1f5ff52fae1fc5ae8d7f2f00afbb1d73 (diff) | |
parent | 84d9b520c2836488e4e1268ad972d232ab54b1c7 (diff) | |
download | scala-96e67c22b3b7bdf54081ba8a194a68e8b7b4740c.tar.gz scala-96e67c22b3b7bdf54081ba8a194a68e8b7b4740c.tar.bz2 scala-96e67c22b3b7bdf54081ba8a194a68e8b7b4740c.zip |
Merge pull request #2579 from vigdorchik/list_map
SI-7502 removing non-existent element from ListMap leaves it unchaged.
Diffstat (limited to 'test/files/run/list_map.scala')
-rwxr-xr-x | test/files/run/list_map.scala | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/list_map.scala b/test/files/run/list_map.scala new file mode 100755 index 0000000000..fba3aae228 --- /dev/null +++ b/test/files/run/list_map.scala @@ -0,0 +1,26 @@ +import collection.immutable.ListMap + +object Test { + def testImmutableMinus() { + val empty = ListMap.empty[Int, Int] + + val m0 = ListMap(1 -> 1, 2 -> 2) + val m1 = m0 - 3 + assert (m1 eq m0) + val m2 = m0 - 1 + assert (m2.size == 1) + val m3 = m2 - 2 + assert (m3 eq empty) + + val m4 = ListMap(1 -> 1, 2 -> 2, 3 -> 3) + val m5 = m4 - 1 + assert (m5 == ListMap(2 -> 2, 3 -> 3)) + assert (m5.toList == (2, 2)::(3, 3)::Nil) + + assert ((empty - 1) eq empty) + } + + def main(args: Array[String]) { + testImmutableMinus() + } +} |