Skip to content

Commit 3ca7a14

Browse files
committed
add node update contents test
1 parent 213072d commit 3ca7a14

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
//
2+
// File.swift
3+
//
4+
//
5+
// Created by Tibor Bodecs on 2022. 02. 06..
6+
//
7+
8+
import XCTest
9+
@testable import SwiftSgml
10+
11+
final class NodeTests: XCTestCase {
12+
13+
func testNodeContents() {
14+
final class FooTag: Tag {
15+
init(_ contents: String? = nil) {
16+
super.init(Node(type: .standard, name: "foo", contents: contents))
17+
}
18+
19+
func updateContents() -> Tag {
20+
node.contents = "bar"
21+
return self
22+
}
23+
}
24+
25+
26+
let doc = Document {
27+
FooTag()
28+
.updateContents()
29+
}
30+
31+
XCTAssertEqual(DocumentRenderer().render(doc), """
32+
<foo>bar</foo>
33+
""")
34+
}
35+
}

0 commit comments

Comments
 (0)