@@ -199,7 +199,26 @@ class TestXMLDocument : LoopbackServerTest {
199
199
func test_stringValue( ) {
200
200
let element = XMLElement ( name: " root " )
201
201
let foo = XMLElement ( name: " foo " )
202
+ let text = XMLNode . text ( withStringValue: " <text> " ) as! XMLNode
203
+ let comment = XMLNode . comment ( withStringValue: " <comment> " ) as! XMLNode
204
+ foo. addChild ( text)
205
+ foo. addChild ( comment)
202
206
element. addChild ( foo)
207
+
208
+ XCTAssertEqual ( text. stringValue, " <text> " )
209
+ XCTAssertEqual ( comment. stringValue, " <comment> " )
210
+ XCTAssertEqual ( foo. stringValue, " <text><comment> " ) // Same with Darwin
211
+ XCTAssertEqual ( element. stringValue, " <text><comment> " ) // Same with Darwin
212
+
213
+ // Confirm that SR-10759 is resolved.
214
+ // https://bugs.swift.org/browse/SR-10759
215
+ text. stringValue = " <modified text> "
216
+ comment. stringValue = " <modified comment> "
217
+ XCTAssertEqual ( text. stringValue, " <modified text> " )
218
+ XCTAssertEqual ( comment. stringValue, " <modified comment> " )
219
+
220
+ XCTAssertEqual ( element. stringValue, " <modified text><modified comment> " )
221
+ XCTAssertEqual ( element. xmlString, " <root><foo><modified text><!--<modified comment>--></foo></root> " )
203
222
204
223
element. stringValue = " Hello!<evil/> "
205
224
XCTAssertEqual ( element. xmlString, " <root>Hello!<evil/></root> " )
0 commit comments