summaryrefslogtreecommitdiff
path: root/test/files/run/OrderingTest.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2009-10-22 16:26:47 +0000
committerPaul Phillips <paulp@improving.org>2009-10-22 16:26:47 +0000
commita2eab2215a7671e8abd8189ccc59388dffc1f3de (patch)
treed4d2e239c0b628d4365cfe3441551c8fa88ca809 /test/files/run/OrderingTest.scala
parentc23174011d44ddf9b405feccf5823d55a6178e06 (diff)
downloadscala-a2eab2215a7671e8abd8189ccc59388dffc1f3de.tar.gz
scala-a2eab2215a7671e8abd8189ccc59388dffc1f3de.tar.bz2
scala-a2eab2215a7671e8abd8189ccc59388dffc1f3de.zip
Added (a variation on) jorge ortiz's sortBy to ...
Added (a variation on) jorge ortiz's sortBy to SeqLike, added docs and test case. Added map to Ordering.
Diffstat (limited to 'test/files/run/OrderingTest.scala')
-rw-r--r--test/files/run/OrderingTest.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/files/run/OrderingTest.scala b/test/files/run/OrderingTest.scala
index 49953b22d0..fee15fc2f9 100644
--- a/test/files/run/OrderingTest.scala
+++ b/test/files/run/OrderingTest.scala
@@ -28,4 +28,9 @@ object Test extends Application {
testAll[Iterable[Int]](List(1, 2), List(2));
testAll((1, "bar"), (1, "foo"))
testAll((1, "foo"), (2, "bar"))
+
+ // sortBy
+ val words = "The quick brown fox jumped over the lazy dog".split(' ')
+ val result = words.sortBy(x => (x.length, x.head))
+ assert(result sameElements Array[String]("The", "dog", "fox", "the", "lazy", "over", "brown", "quick", "jumped"))
}