Skip to content

Commit 19511d8

Browse files
committed
Test for error message on class size overflow
Ensure that the error message for too large classes contains the class name
1 parent 7f5a939 commit 19511d8

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

test/files/run/large_class.check

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
newSource1.scala:1: error: Could not write class BigEnoughToFail because it exceeds JVM code size limits. Class file too large!
2+
class BigEnoughToFail {
3+
^

test/files/run/large_class.scala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import scala.tools.partest._
2+
import java.io.{Console => _, _}
3+
4+
// a cold run of partest takes about 15s for this test on my laptop
5+
object Test extends DirectTest {
6+
override def extraSettings: String = "-usejavacp -d " + testOutput.path
7+
8+
def s(n: Int) = "\""+n+"\""
9+
10+
override def code
11+
= s"""
12+
|class BigEnoughToFail {
13+
| def m(a: String, b: String, c: String, d: String, e: String, f: String) = null
14+
| ${(1 to 5500) map (n => "def f"+n+" = m("+ s(n+10000)+","+
15+
s(n+20000)+","+
16+
s(n+30000)+","+
17+
s(n+40000)+","+
18+
s(n+50000)+","+
19+
s(n+60000)+")") mkString ";"}
20+
|}""".stripMargin.trim
21+
22+
override def show(): Unit = {
23+
Console.withErr(System.out) {
24+
compile()
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)