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(
128128 line: UInt = #line,
129129 column: UInt = #column
130130) {
131+ var indentationWidth = indentationWidth
132+ ?? MacroTestingConfiguration . current. indentationWidth
133+ var macros = macros
134+ ?? MacroTestingConfiguration . current. macros
135+ var record = record
136+ ?? SnapshotTestingConfiguration . current? . record
131137 #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
135144 #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) {
142146 guard let macros, !macros. isEmpty else {
143147 recordIssue (
144148 """
Original file line number Diff line number Diff line change 3535 }
3636
3737 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+
3847 var macros : [ String : Macro . Type ] ? {
3948 for trait in traits. reversed ( ) {
4049 if let macros = ( trait as? _MacrosTestTrait ) ? . configuration. macros {
You can’t perform that action at this time.
0 commit comments