Skip to content

Commit c8916eb

Browse files
committed
refine debug descriptions
1 parent 087a91b commit c8916eb

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

Sources/DebugDescriptions.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private func debugDescriptionBuilder<Target: TextOutputStream>(
4343
for (element, indent) in elements {
4444
switch element {
4545
case let .type(type):
46-
buildString("<\(type):", indent: indent, to: &output)
46+
buildString("\(type) {", indent: indent, to: &output)
4747

4848
case let .index(index):
4949
buildString("[\(index)]:", indent: indent, to: &output)
@@ -124,7 +124,7 @@ private func debugDescriptionBuilder<Target: TextOutputStream>(
124124
buildString("isEmpty: \(isEmpty)", indent: indent, to: &output)
125125

126126
case .end:
127-
buildString(">", indent: indent, to: &output)
127+
buildString("}", indent: indent, to: &output)
128128
}
129129
}
130130
}

Tests/TestDebugDescriptionCollection.swift

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ final class TestDebugDescriptionCollection: XCTestCase {
2727
XCTAssertEqual(
2828
viewModel1.debugDescription,
2929
"""
30-
<CollectionViewModel:
30+
CollectionViewModel {
3131
id: viewModel_1
3232
sections: none
3333
registrations: none
3434
isEmpty: true
35-
>
35+
}
3636
3737
"""
3838
)
@@ -48,7 +48,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
4848
XCTAssertEqual(
4949
viewModel4.debugDescription,
5050
"""
51-
<CollectionViewModel:
51+
CollectionViewModel {
5252
id: viewModel_4
5353
sections:
5454
[0]:
@@ -65,7 +65,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
6565
- FakeNumberCellViewModel (cell)
6666
- FakeTextCellViewModel (cell)
6767
isEmpty: false
68-
>
68+
}
6969
7070
"""
7171
)
@@ -79,7 +79,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
7979
XCTAssertEqual(
8080
viewModel5.debugDescription,
8181
"""
82-
<CollectionViewModel:
82+
CollectionViewModel {
8383
id: viewModel_5
8484
sections:
8585
[0]:
@@ -95,7 +95,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
9595
registrations:
9696
- FakeCellNibViewModel (cell)
9797
isEmpty: false
98-
>
98+
}
9999
100100
"""
101101
)
@@ -112,7 +112,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
112112
XCTAssertEqual(
113113
viewModel6.debugDescription,
114114
"""
115-
<CollectionViewModel:
115+
CollectionViewModel {
116116
id: viewModel_6
117117
sections:
118118
[0]:
@@ -130,7 +130,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
130130
- FakeNumberCellViewModel (cell)
131131
- FakeTextCellViewModel (cell)
132132
isEmpty: false
133-
>
133+
}
134134
135135
"""
136136
)
@@ -144,7 +144,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
144144
XCTAssertEqual(
145145
viewModel7.debugDescription,
146146
"""
147-
<CollectionViewModel:
147+
CollectionViewModel {
148148
id: viewModel_7
149149
sections:
150150
[0]:
@@ -162,7 +162,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
162162
- FakeNumberCellViewModel (cell)
163163
- FakeTextCellViewModel (cell)
164164
isEmpty: false
165-
>
165+
}
166166
167167
"""
168168
)
@@ -177,7 +177,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
177177
XCTAssertEqual(
178178
viewModel8.debugDescription,
179179
"""
180-
<CollectionViewModel:
180+
CollectionViewModel {
181181
id: viewModel_8
182182
sections:
183183
[0]:
@@ -196,7 +196,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
196196
- FakeNumberCellViewModel (cell)
197197
- FakeTextCellViewModel (cell)
198198
isEmpty: false
199-
>
199+
}
200200
201201
"""
202202
)
@@ -215,7 +215,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
215215
XCTAssertEqual(
216216
viewModel9.debugDescription,
217217
"""
218-
<CollectionViewModel:
218+
CollectionViewModel {
219219
id: viewModel_9
220220
sections:
221221
[0]:
@@ -238,7 +238,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
238238
- FakeSupplementaryViewModel (FakeKind)
239239
- FakeTextCellViewModel (cell)
240240
isEmpty: false
241-
>
241+
}
242242
243243
"""
244244
)
@@ -254,7 +254,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
254254
XCTAssertEqual(
255255
viewModel12.debugDescription,
256256
"""
257-
<CollectionViewModel:
257+
CollectionViewModel {
258258
id: viewModel_12
259259
sections:
260260
[0]:
@@ -281,7 +281,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
281281
- FakeNumberCellViewModel (cell)
282282
- FakeTextCellViewModel (cell)
283283
isEmpty: false
284-
>
284+
}
285285
286286
"""
287287
)
@@ -295,7 +295,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
295295
XCTAssertEqual(
296296
viewModel13.debugDescription,
297297
"""
298-
<CollectionViewModel:
298+
CollectionViewModel {
299299
id: viewModel_13
300300
sections:
301301
[0]:
@@ -321,7 +321,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
321321
registrations:
322322
- FakeCellNibViewModel (cell)
323323
isEmpty: false
324-
>
324+
}
325325
326326
"""
327327
)
@@ -335,7 +335,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
335335
XCTAssertEqual(
336336
viewModel14.debugDescription,
337337
"""
338-
<CollectionViewModel:
338+
CollectionViewModel {
339339
id: viewModel_14
340340
sections:
341341
[0]:
@@ -363,7 +363,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
363363
- FakeNumberCellViewModel (cell)
364364
- FakeTextCellViewModel (cell)
365365
isEmpty: false
366-
>
366+
}
367367
368368
"""
369369
)
@@ -380,7 +380,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
380380
XCTAssertEqual(
381381
viewModel15.debugDescription,
382382
"""
383-
<CollectionViewModel:
383+
CollectionViewModel {
384384
id: viewModel_15
385385
sections:
386386
[0]:
@@ -408,7 +408,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
408408
- FakeNumberCellViewModel (cell)
409409
- FakeTextCellViewModel (cell)
410410
isEmpty: false
411-
>
411+
}
412412
413413
"""
414414
)
@@ -423,7 +423,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
423423
XCTAssertEqual(
424424
viewModel16.debugDescription,
425425
"""
426-
<CollectionViewModel:
426+
CollectionViewModel {
427427
id: viewModel_16
428428
sections:
429429
[0]:
@@ -452,7 +452,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
452452
- FakeNumberCellViewModel (cell)
453453
- FakeTextCellViewModel (cell)
454454
isEmpty: false
455-
>
455+
}
456456
457457
"""
458458
)
@@ -468,7 +468,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
468468
XCTAssertEqual(
469469
viewModel17.debugDescription,
470470
"""
471-
<CollectionViewModel:
471+
CollectionViewModel {
472472
id: viewModel_17
473473
sections:
474474
[0]:
@@ -504,7 +504,7 @@ final class TestDebugDescriptionCollection: XCTestCase {
504504
- FakeSupplementaryViewModel (FakeKind)
505505
- FakeTextCellViewModel (cell)
506506
isEmpty: false
507-
>
507+
}
508508
509509
"""
510510
)

Tests/TestDebugDescriptionSection.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ final class TestDebugDescriptionSection: XCTestCase {
2626
XCTAssertEqual(
2727
viewModel1.debugDescription,
2828
"""
29-
<SectionViewModel:
29+
SectionViewModel {
3030
id: viewModel_1
3131
header: nil
3232
footer: nil
3333
cells: none
3434
supplementary views: none
3535
registrations: none
3636
isEmpty: true
37-
>
37+
}
3838
3939
"""
4040
)
@@ -49,7 +49,7 @@ final class TestDebugDescriptionSection: XCTestCase {
4949
XCTAssertEqual(
5050
viewModel2.debugDescription,
5151
"""
52-
<SectionViewModel:
52+
SectionViewModel {
5353
id: viewModel_2
5454
header: nil
5555
footer: nil
@@ -59,7 +59,7 @@ final class TestDebugDescriptionSection: XCTestCase {
5959
registrations:
6060
- FakeNumberCellViewModel (cell)
6161
isEmpty: false
62-
>
62+
}
6363
6464
"""
6565
)
@@ -74,7 +74,7 @@ final class TestDebugDescriptionSection: XCTestCase {
7474
XCTAssertEqual(
7575
viewModel4.debugDescription,
7676
"""
77-
<SectionViewModel:
77+
SectionViewModel {
7878
id: viewModel_4
7979
header: nil
8080
footer: nil
@@ -87,7 +87,7 @@ final class TestDebugDescriptionSection: XCTestCase {
8787
- FakeNumberCellViewModel (cell)
8888
- FakeTextCellViewModel (cell)
8989
isEmpty: false
90-
>
90+
}
9191
9292
"""
9393
)
@@ -100,7 +100,7 @@ final class TestDebugDescriptionSection: XCTestCase {
100100
XCTAssertEqual(
101101
viewModel5.debugDescription,
102102
"""
103-
<SectionViewModel:
103+
SectionViewModel {
104104
id: viewModel_5
105105
header: nil
106106
footer: nil
@@ -112,7 +112,7 @@ final class TestDebugDescriptionSection: XCTestCase {
112112
registrations:
113113
- FakeCellNibViewModel (cell)
114114
isEmpty: false
115-
>
115+
}
116116
117117
"""
118118
)
@@ -128,7 +128,7 @@ final class TestDebugDescriptionSection: XCTestCase {
128128
XCTAssertEqual(
129129
viewModel6.debugDescription,
130130
"""
131-
<SectionViewModel:
131+
SectionViewModel {
132132
id: viewModel_6
133133
header: Header (FakeHeaderViewModel)
134134
footer: nil
@@ -142,7 +142,7 @@ final class TestDebugDescriptionSection: XCTestCase {
142142
- FakeNumberCellViewModel (cell)
143143
- FakeTextCellViewModel (cell)
144144
isEmpty: false
145-
>
145+
}
146146
147147
"""
148148
)
@@ -155,7 +155,7 @@ final class TestDebugDescriptionSection: XCTestCase {
155155
XCTAssertEqual(
156156
viewModel7.debugDescription,
157157
"""
158-
<SectionViewModel:
158+
SectionViewModel {
159159
id: viewModel_7
160160
header: nil
161161
footer: Footer (FakeFooterViewModel)
@@ -169,7 +169,7 @@ final class TestDebugDescriptionSection: XCTestCase {
169169
- FakeNumberCellViewModel (cell)
170170
- FakeTextCellViewModel (cell)
171171
isEmpty: false
172-
>
172+
}
173173
174174
"""
175175
)
@@ -183,7 +183,7 @@ final class TestDebugDescriptionSection: XCTestCase {
183183
XCTAssertEqual(
184184
viewModel8.debugDescription,
185185
"""
186-
<SectionViewModel:
186+
SectionViewModel {
187187
id: viewModel_8
188188
header: Header (FakeHeaderViewModel)
189189
footer: Footer (FakeFooterViewModel)
@@ -198,7 +198,7 @@ final class TestDebugDescriptionSection: XCTestCase {
198198
- FakeNumberCellViewModel (cell)
199199
- FakeTextCellViewModel (cell)
200200
isEmpty: false
201-
>
201+
}
202202
203203
"""
204204
)
@@ -213,7 +213,7 @@ final class TestDebugDescriptionSection: XCTestCase {
213213
XCTAssertEqual(
214214
viewModel9.debugDescription,
215215
"""
216-
<SectionViewModel:
216+
SectionViewModel {
217217
id: viewModel_9
218218
header: Header (FakeHeaderViewModel)
219219
footer: Footer (FakeFooterViewModel)
@@ -232,7 +232,7 @@ final class TestDebugDescriptionSection: XCTestCase {
232232
- FakeSupplementaryViewModel (FakeKind)
233233
- FakeTextCellViewModel (cell)
234234
isEmpty: false
235-
>
235+
}
236236
237237
"""
238238
)

0 commit comments

Comments
 (0)