Skip to content

Commit

Permalink
Improve XMLStackParserTests to test against CDATA blocks (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
regexident authored and hodovani committed Jan 2, 2019
1 parent 32d632f commit aacaa69
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Tests/XMLCoderTests/Auxiliary/XMLStackParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ class XMLStackParserTests: XCTestCase {
func testParseWith() throws {
let parser = _XMLStackParser()

let xmlString = "<container><value>42</value></container>"
let xmlString =
"""
<container>
<value>42</value>
<data><![CDATA[lorem ipsum]]></data>
</container>
"""
let xmlData = xmlString.data(using: .utf8)!

let root: _XMLElement? = try parser.parse(with: xmlData,
Expand All @@ -27,6 +33,12 @@ class XMLStackParserTests: XCTestCase {
value: "42"
),
],
"data": [
_XMLElement(
key: "data",
value: "lorem ipsum"
),
],
]
)
XCTAssertEqual(root, expected)
Expand Down

0 comments on commit aacaa69

Please sign in to comment.