diff options
author | michelou <michelou@epfl.ch> | 2007-03-16 13:34:42 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2007-03-16 13:34:42 +0000 |
commit | 3d4d7ce3ef2ef6a42c8e4f035058b4e5e76b88b1 (patch) | |
tree | a86e3c6829ef976c9e874c6ef9762ee43e34f420 /test/files/run | |
parent | 6d93465512f46b7e26226ef565e399adc63b993c (diff) | |
download | scala-3d4d7ce3ef2ef6a42c8e4f035058b4e5e76b88b1.tar.gz scala-3d4d7ce3ef2ef6a42c8e4f035058b4e5e76b88b1.tar.bz2 scala-3d4d7ce3ef2ef6a42c8e4f035058b4e5e76b88b1.zip |
added Array.deepToString, cleaned up MatchError
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/deepToString.check | 49 | ||||
-rw-r--r-- | test/files/run/deepToString.scala | 41 |
2 files changed, 90 insertions, 0 deletions
diff --git a/test/files/run/deepToString.check b/test/files/run/deepToString.check new file mode 100644 index 0000000000..fcc0e04575 --- /dev/null +++ b/test/files/run/deepToString.check @@ -0,0 +1,49 @@ +Array(true,false) +Array(true,false) +[true;false] +true;false + +Array([Z@0000000,[Z@0000000) +Array(Array(true,false),Array(true,false)) +[[true;false];[true;false]] +true;false;true;false + +Array([[Z@0000000,[[Z@0000000) +Array(Array(Array(true,false),Array(true,false)),Array(Array(true,false),Array(true,false))) +[[[true;false];[true;false]];[[true;false];[true;false]]] +true;false;true;false;true;false;true;false + +Array(1.0,0.0) +Array(1.0,0.0) +[1.0;0.0] +1.0;0.0 + +Array([D@0000000,[D@0000000) +Array(Array(1.0,0.0),Array(1.0,0.0)) +[[1.0;0.0];[1.0;0.0]] +1.0;0.0;1.0;0.0 + +Array([[D@0000000,[[D@0000000) +Array(Array(Array(1.0,0.0),Array(1.0,0.0)),Array(Array(1.0,0.0),Array(1.0,0.0))) +[[[1.0;0.0];[1.0;0.0]];[[1.0;0.0];[1.0;0.0]]] +1.0;0.0;1.0;0.0;1.0;0.0;1.0;0.0 + +Array(a,b) +Array(a,b) +[a;b] +a;b + +Array([Ljava.lang.String;@0000000,[Ljava.lang.String;@0000000) +Array(Array(a,b),Array(a,b)) +[[a;b];[a;b]] +a;b;a;b + +Array([[Ljava.lang.String;@0000000,[[Ljava.lang.String;@0000000) +Array(Array(Array(a,b),Array(a,b)),Array(Array(a,b),Array(a,b))) +[[[a;b];[a;b]];[[a;b];[a;b]]] +a;b;a;b;a;b;a;b + +[[true; false]; [false]] +[[1; 2]; [3]] +[[1; 2]; [3]] + diff --git a/test/files/run/deepToString.scala b/test/files/run/deepToString.scala new file mode 100644 index 0000000000..1fb73fe5a5 --- /dev/null +++ b/test/files/run/deepToString.scala @@ -0,0 +1,41 @@ +object Test extends Application { + + def sweep(s: String) = + s.replaceAll("D@[0-9a-fA-F]+", "D@0000000") + .replaceAll("Z@[0-9a-fA-F]+", "Z@0000000") + .replaceAll(";@[0-9a-fA-F]+", ";@0000000") + + def test[A](a: Array[A]) { + Console.println(sweep(a.toString)) + Console.println(a.deepToString) + Console.println(a.deepMkString("[", ";", "]")) + Console.println(a.deepMkString(";")) + Console.println + } + + val ba1 = Array(true, false) + val ba2 = Array(ba1, ba1) + val ba3 = Array(ba2, ba2) + test(ba1) + test(ba2) + test(ba3) + + val da1 = Array(1.0d, 0.0d) + val da2 = Array(da1, da1) + val da3 = Array(da2, da2) + test(da1) + test(da2) + test(da3) + + val sa1 = Array("a", "b") + val sa2 = Array(sa1, sa1) + val sa3 = Array(sa2, sa2) + test(sa1) + test(sa2) + test(sa3) + + Console.println(Array(Array(true, false), Array(false)).deepMkString("[", "; ", "]")) + Console.println(Array(Array('1', '2'), Array('3')).deepMkString("[", "; ", "]")) + Console.println(Array(Array(1, 2), Array(3)).deepMkString("[", "; ", "]")) + Console.println +} |