summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2015-04-09 17:01:08 -0700
committerAdriaan Moors <adriaan.moors@typesafe.com>2015-04-09 17:01:08 -0700
commit3cf7c958fdb83258e7ad626f5a6c7fa8a4b2241b (patch)
treef47c623a6f52754909c5031fc18008e3312f98f6 /test
parent3ce8417b9ab00963c3da342d03a45ed492d6b69b (diff)
parentef7b5524a7d6a2da82c32f16632ed2304130f32a (diff)
downloadscala-3cf7c958fdb83258e7ad626f5a6c7fa8a4b2241b.tar.gz
scala-3cf7c958fdb83258e7ad626f5a6c7fa8a4b2241b.tar.bz2
scala-3cf7c958fdb83258e7ad626f5a6c7fa8a4b2241b.zip
Merge pull request #4306 from som-snytt/issue/3368-b
SI-3368 CDATA gets a Node
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/t3368.flags1
-rw-r--r--test/files/pos/t3368.scala5
-rw-r--r--test/files/run/t3368.check46
-rw-r--r--test/files/run/t3368.scala18
-rwxr-xr-xtest/files/run/t5699.scala14
5 files changed, 73 insertions, 11 deletions
diff --git a/test/files/pos/t3368.flags b/test/files/pos/t3368.flags
new file mode 100644
index 0000000000..cb20509902
--- /dev/null
+++ b/test/files/pos/t3368.flags
@@ -0,0 +1 @@
+-Ystop-after:parser
diff --git a/test/files/pos/t3368.scala b/test/files/pos/t3368.scala
new file mode 100644
index 0000000000..c8e861a899
--- /dev/null
+++ b/test/files/pos/t3368.scala
@@ -0,0 +1,5 @@
+
+trait X {
+ // error: in XML literal: name expected, but char '!' cannot start a name
+ def x = <![CDATA[hi & bye]]> <![CDATA[red & black]]>
+}
diff --git a/test/files/run/t3368.check b/test/files/run/t3368.check
new file mode 100644
index 0000000000..1d9dd677f6
--- /dev/null
+++ b/test/files/run/t3368.check
@@ -0,0 +1,46 @@
+[[syntax trees at end of parser]] // newSource1.scala
+package <empty> {
+ abstract trait X extends scala.AnyRef {
+ def $init$() = {
+ ()
+ };
+ def x = {
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus(new _root_.scala.xml.PCData("hi & bye"));
+ $buf.$amp$plus(new _root_.scala.xml.PCData("red & black"));
+ $buf
+ }
+ };
+ abstract trait Y extends scala.AnyRef {
+ def $init$() = {
+ ()
+ };
+ def y = {
+ {
+ new _root_.scala.xml.Elem(null, "a", _root_.scala.xml.Null, $scope, false, ({
+ val $buf = new _root_.scala.xml.NodeBuffer();
+ $buf.$amp$plus({
+ {
+ new _root_.scala.xml.Elem(null, "b", _root_.scala.xml.Null, $scope, true)
+ }
+ });
+ $buf.$amp$plus(new _root_.scala.xml.Text("starthi & bye"));
+ $buf.$amp$plus({
+ {
+ new _root_.scala.xml.Elem(null, "c", _root_.scala.xml.Null, $scope, true)
+ }
+ });
+ $buf.$amp$plus(new _root_.scala.xml.Text("world"));
+ $buf.$amp$plus({
+ {
+ new _root_.scala.xml.Elem(null, "d", _root_.scala.xml.Null, $scope, true)
+ }
+ });
+ $buf.$amp$plus(new _root_.scala.xml.Text("stuffred & black"));
+ $buf
+ }: _*))
+ }
+ }
+ }
+}
+
diff --git a/test/files/run/t3368.scala b/test/files/run/t3368.scala
new file mode 100644
index 0000000000..15acba5099
--- /dev/null
+++ b/test/files/run/t3368.scala
@@ -0,0 +1,18 @@
+
+import scala.tools.partest.ParserTest
+
+
+object Test extends ParserTest {
+
+ override def code = """
+ trait X {
+ // error: in XML literal: name expected, but char '!' cannot start a name
+ def x = <![CDATA[hi & bye]]> <![CDATA[red & black]]>
+ }
+ trait Y {
+ def y = <a><b/>start<![CDATA[hi & bye]]><c/>world<d/>stuff<![CDATA[red & black]]></a>
+ }
+ """
+
+ override def extraSettings = s"${super.extraSettings} -Xxml:coalescing"
+}
diff --git a/test/files/run/t5699.scala b/test/files/run/t5699.scala
index ec3b1d26b4..409bcd250c 100755
--- a/test/files/run/t5699.scala
+++ b/test/files/run/t5699.scala
@@ -1,21 +1,13 @@
-import scala.tools.partest.DirectTest
+import scala.tools.partest.ParserTest
import scala.reflect.internal.util.BatchSourceFile
-object Test extends DirectTest {
+object Test extends ParserTest {
// Java code
override def code = """
|public @interface MyAnnotation { String value(); }
""".stripMargin
- override def extraSettings: String = "-usejavacp -Ystop-after:typer -Xprint:parser"
-
- override def show(): Unit = {
- // redirect err to out, for logging
- val prevErr = System.err
- System.setErr(System.out)
- compile()
- System.setErr(prevErr)
- }
+ override def extraSettings: String = "-usejavacp -Ystop-after:namer -Xprint:parser"
override def newSources(sourceCodes: String*) = {
assert(sourceCodes.size == 1)