summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel C. Sobral <dcsobral@gmail.com>2012-01-17 17:26:59 -0200
committerDaniel C. Sobral <dcsobral@gmail.com>2012-01-17 17:26:59 -0200
commit76caa37f22b70b126563df8a5eeab1b8bf693fc9 (patch)
tree2480da56cb8bebd0aa2843e1c9b87c41957bd226 /test
parent9d55bf45cd13107ad8f3e5e75737f37e75b22f90 (diff)
downloadscala-76caa37f22b70b126563df8a5eeab1b8bf693fc9.tar.gz
scala-76caa37f22b70b126563df8a5eeab1b8bf693fc9.tar.bz2
scala-76caa37f22b70b126563df8a5eeab1b8bf693fc9.zip
Fix check for number of arguments
Fix the test for number of arguments by passing all arguments instead of passing the argument list as a single argument. Add positive and negative tests for it.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/interpolation.check6
-rw-r--r--test/files/run/interpolation.scala2
-rw-r--r--test/files/run/interpolationArgs.check2
-rw-r--r--test/files/run/interpolationArgs.flags1
-rw-r--r--test/files/run/interpolationArgs.scala5
5 files changed, 16 insertions, 0 deletions
diff --git a/test/files/run/interpolation.check b/test/files/run/interpolation.check
index 4c34e4c8c8..09579a800a 100644
--- a/test/files/run/interpolation.check
+++ b/test/files/run/interpolation.check
@@ -2,14 +2,20 @@ Bob is 1 years old
Bob is 1 years old
Bob will be 2 years old
Bob will be 2 years old
+1+1 = 2
+1+1 = 2
Bob is 12 years old
Bob is 12 years old
Bob will be 13 years old
Bob will be 13 years old
+12+1 = 13
+12+1 = 13
Bob is 123 years old
Bob is 123 years old
Bob will be 124 years old
Bob will be 124 years old
+123+1 = 124
+123+1 = 124
Best price: 10.0
Best price: 10.00
10.0% discount included
diff --git a/test/files/run/interpolation.scala b/test/files/run/interpolation.scala
index 232a180bcd..a0a185eaab 100644
--- a/test/files/run/interpolation.scala
+++ b/test/files/run/interpolation.scala
@@ -5,6 +5,8 @@ object Test extends App {
println(f"Bob is $n%2d years old")
println(s"Bob will be ${n+1} years old")
println(f"Bob will be ${n+1}%2d years old")
+ println(s"$n+1 = ${n+1}")
+ println(f"$n%d+1 = ${n+1}%d")
}
def test2(f: Float) = {
diff --git a/test/files/run/interpolationArgs.check b/test/files/run/interpolationArgs.check
new file mode 100644
index 0000000000..155991e618
--- /dev/null
+++ b/test/files/run/interpolationArgs.check
@@ -0,0 +1,2 @@
+java.lang.IllegalArgumentException: wrong number of arguments for interpolated string
+java.lang.IllegalArgumentException: wrong number of arguments for interpolated string
diff --git a/test/files/run/interpolationArgs.flags b/test/files/run/interpolationArgs.flags
new file mode 100644
index 0000000000..e1b37447c9
--- /dev/null
+++ b/test/files/run/interpolationArgs.flags
@@ -0,0 +1 @@
+-Xexperimental \ No newline at end of file
diff --git a/test/files/run/interpolationArgs.scala b/test/files/run/interpolationArgs.scala
new file mode 100644
index 0000000000..eb13767907
--- /dev/null
+++ b/test/files/run/interpolationArgs.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ try { scala.StringContext("p1", "p2", "p3").s("e1") } catch { case ex => println(ex) }
+ try { scala.StringContext("p1").s("e1") } catch { case ex => println(ex) }
+}
+