Skip to content

Commit 6749c5c

Browse files
committed
Add PCData unit test
1 parent 390bd11 commit 6749c5c

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package scala.xml
2+
3+
import org.junit.Test
4+
import org.junit.Assert.assertEquals
5+
6+
class PCDataTest {
7+
8+
@Test
9+
def emptyTest = {
10+
val pcdata = new PCData("")
11+
assertEquals("<![CDATA[]]>", pcdata.toString)
12+
}
13+
14+
@Test
15+
def bracketTest = {
16+
val pcdata = new PCData("[]")
17+
assertEquals("<![CDATA[[]]]>", pcdata.toString)
18+
}
19+
20+
@Test
21+
def hellaBracketingTest = {
22+
val pcdata = new PCData("[[[[[[[[]]]]]]]]")
23+
assertEquals("<![CDATA[[[[[[[[[]]]]]]]]]]>", pcdata.toString)
24+
}
25+
26+
@Test
27+
def simpleNestingTest = {
28+
val pcdata = new PCData("]]>")
29+
assertEquals("<![CDATA[]]]]><![CDATA[>]]>", pcdata.toString)
30+
}
31+
32+
@Test
33+
def recursiveNestingTest = {
34+
val pcdata = new PCData("<![CDATA[]]>")
35+
assertEquals("<![CDATA[<![CDATA[]]]]><![CDATA[>]]>", pcdata.toString)
36+
}
37+
}

0 commit comments

Comments
 (0)