summaryrefslogtreecommitdiff
path: root/test/files/run/t3368-d.scala
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2015-04-16 12:07:02 -0700
committerSom Snytt <som.snytt@gmail.com>2015-04-16 12:07:02 -0700
commit498a07fcd8d922545e942b817d3fbd16ef56809b (patch)
tree2bdd71dd47eb2e209bd585087cc20215f028b5d9 /test/files/run/t3368-d.scala
parent8623c2be74f8de0c400dcc04eb6f83168c6272c0 (diff)
downloadscala-498a07fcd8d922545e942b817d3fbd16ef56809b.tar.gz
scala-498a07fcd8d922545e942b817d3fbd16ef56809b.tar.bz2
scala-498a07fcd8d922545e942b817d3fbd16ef56809b.zip
SI-3368 Default to coalescing for 2.11
Preserve current behavior (no PCData nodes, only Text) for 2.11. The coalescing flag is on if enabled or if source level is not 2.12 and no flag was supplied. The subtle change is that adjacent Text nodes are thereby coalesced. This happens in the presence of CData sections, but this is at the discretion of the parser anyway. Also, no PCData nodes are emitted under coalescing, even if there were no sibling text nodes. That is the correct behavior: the general idea is that coalescing mode says, I only want to deal with text.
Diffstat (limited to 'test/files/run/t3368-d.scala')
-rw-r--r--test/files/run/t3368-d.scala26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/files/run/t3368-d.scala b/test/files/run/t3368-d.scala
new file mode 100644
index 0000000000..5777c1a81e
--- /dev/null
+++ b/test/files/run/t3368-d.scala
@@ -0,0 +1,26 @@
+
+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>
+ }
+ trait Z {
+ def d = <![CDATA[hello, world]]>
+ def e = <![CDATA[hello, world]]><![CDATA[hello, world]]> // top level not coalesced
+ def f = <foo>x<![CDATA[hello, world]]></foo> // adjoining text
+ def g = <foo><![CDATA[hello, world]]></foo> // text node when coalescing
+ def h = <foo><![CDATA[hello, world]]><![CDATA[hello, world]]></foo>
+ }
+ """
+
+ // default under 2.12 is not coalescing
+ override def extraSettings = s"${super.extraSettings} -Xsource:212"
+}