File tree Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -128,17 +128,21 @@ public func assertMacro(
128
128
line: UInt = #line,
129
129
column: UInt = #column
130
130
) {
131
+ var indentationWidth = indentationWidth
132
+ ?? MacroTestingConfiguration . current. indentationWidth
133
+ var macros = macros
134
+ ?? MacroTestingConfiguration . current. macros
135
+ var record = record
136
+ ?? SnapshotTestingConfiguration . current? . record
131
137
#if canImport(Testing)
132
- let record = record ?? SnapshotTestingConfiguration . current? . record ?? Test . current? . record
133
- #else
134
- let record = record ?? SnapshotTestingConfiguration . current? . record
138
+ indentationWidth = indentationWidth
139
+ ?? Test . current? . indentationWidth
140
+ macros = macros
141
+ ?? Test . current? . macros
142
+ record = record
143
+ ?? Test . current? . record
135
144
#endif
136
- withSnapshotTesting ( record: record) {
137
- #if canImport(Testing)
138
- let macros = macros ?? MacroTestingConfiguration . current. macros ?? Test . current? . macros
139
- #else
140
- let macros = macros ?? MacroTestingConfiguration . current. macros
141
- #endif
145
+ withMacroTesting ( indentationWidth: indentationWidth, record: record, macros: macros) {
142
146
guard let macros, !macros. isEmpty else {
143
147
recordIssue (
144
148
"""
Original file line number Diff line number Diff line change 35
35
}
36
36
37
37
extension Test {
38
+ var indentationWidth : Trivia ? {
39
+ for trait in traits. reversed ( ) {
40
+ if let indentationWidth = ( trait as? _MacrosTestTrait ) ? . configuration. indentationWidth {
41
+ return indentationWidth
42
+ }
43
+ }
44
+ return nil
45
+ }
46
+
38
47
var macros : [ String : Macro . Type ] ? {
39
48
for trait in traits. reversed ( ) {
40
49
if let macros = ( trait as? _MacrosTestTrait ) ? . configuration. macros {
You can’t perform that action at this time.
0 commit comments