-
Notifications
You must be signed in to change notification settings - Fork 104
/
BoxTreeTests.swift
46 lines (41 loc) · 1.01 KB
/
BoxTreeTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//
// BoxTreeTests.swift
// XMLCoderTests
//
// Created by Max Desiatov on 07/04/2019.
//
import XCTest
@testable import XMLCoder
class BoxTreeTests: XCTestCase {
func testNestedValues() {
let e1 = XMLCoderElement(
key: "foo",
value: "456",
elements: [],
attributes: ["id": "123"]
)
let e2 = XMLCoderElement(
key: "foo",
value: "123",
elements: [],
attributes: ["id": "789"]
)
let root = XMLCoderElement(
key: "container",
value: nil,
elements: [e1, e2],
attributes: [:]
)
let boxTree = root.transformToBoxTree()
guard let foo = boxTree.elements["foo"] as? UnkeyedBox else {
XCTAssert(
false,
"""
flattened.elements["foo"] is not an UnkeyedBox
"""
)
return
}
XCTAssertEqual(foo.count, 2)
}
}