@@ -23,20 +23,16 @@ import SWBMacro
23
23
let namespace = MacroNamespace ( debugDescription: " test " )
24
24
25
25
let firstBoolDecl = try namespace. declareBooleanMacro ( " SomeBooleanMacro " )
26
- #expect( firstBoolDecl != nil )
27
26
#expect( firstBoolDecl. type == . boolean)
28
27
29
28
let repeatedBoolDecl = try namespace. declareBooleanMacro ( " SomeBooleanMacro " )
30
- #expect( repeatedBoolDecl != nil )
31
29
#expect( repeatedBoolDecl. type == . boolean)
32
30
#expect( repeatedBoolDecl === firstBoolDecl)
33
31
34
32
var didCatchExpectedException : Bool = false
35
33
do {
36
- let collidingStringDecl = try namespace. declareStringMacro ( " SomeBooleanMacro " )
37
- #expect( collidingStringDecl == nil )
38
- }
39
- catch {
34
+ _ = try namespace. declareStringMacro ( " SomeBooleanMacro " )
35
+ } catch {
40
36
didCatchExpectedException = true
41
37
}
42
38
#expect( didCatchExpectedException)
@@ -48,27 +44,21 @@ import SWBMacro
48
44
let namespace = MacroNamespace ( debugDescription: " test " )
49
45
50
46
let booleanDecl = try namespace. declareBooleanMacro ( " BooleanMacro " )
51
- #expect( booleanDecl != nil )
52
47
#expect( booleanDecl. type == . boolean)
53
48
54
49
let stringDecl = try namespace. declareStringMacro ( " StringMacro " )
55
- #expect( stringDecl != nil )
56
50
#expect( stringDecl. type == . string)
57
51
58
52
let stringListDecl = try namespace. declareStringListMacro ( " StringListMacro " )
59
- #expect( stringListDecl != nil )
60
53
#expect( stringListDecl. type == . stringList)
61
54
62
55
let userDefinedDecl = try namespace. declareUserDefinedMacro ( " UserDefinedMacro " )
63
- #expect( userDefinedDecl != nil )
64
56
#expect( userDefinedDecl. type == . userDefined)
65
57
66
58
let pathDecl = try namespace. declarePathMacro ( " PathMacro " )
67
- #expect( pathDecl != nil )
68
59
#expect( pathDecl. type == . path)
69
60
70
61
let pathListDecl = try namespace. declarePathListMacro ( " PathListMacro " )
71
- #expect( pathListDecl != nil )
72
62
#expect( pathListDecl. type == . pathList)
73
63
74
64
var diags1 = Array < MacroExpressionDiagnostic > ( )
@@ -116,19 +106,16 @@ import SWBMacro
116
106
117
107
// Declarate a string macro in the lower namespace.
118
108
let lowerStringDecl = try lowerNamespace. declareStringMacro ( " StringMacro " )
119
- #expect( lowerStringDecl != nil )
120
109
#expect( lowerStringDecl. type == . string)
121
110
122
111
// Create the middle of the three namespaces, and make sure we can see the string macro declaration from the lower namespace.
123
112
let middleNamespace = MacroNamespace ( parent: lowerNamespace, debugDescription: " middle " )
124
113
let middleStringDecl = try middleNamespace. declareStringMacro ( " StringMacro " )
125
- #expect( middleStringDecl != nil )
126
114
#expect( middleStringDecl. type == . string)
127
115
#expect( middleStringDecl === lowerStringDecl)
128
116
129
117
// Also declare a string list macro in the middle namespace.
130
118
let middleStringListDecl = try middleNamespace. declareStringListMacro ( " StringListMacro " )
131
- #expect( middleStringListDecl != nil )
132
119
#expect( middleStringListDecl. type == . stringList)
133
120
134
121
// Make sure we cannot reach the middle-namespace string list macro declaration if we do the lookup from the lower namespace.
@@ -138,19 +125,16 @@ import SWBMacro
138
125
// Create the upper of the three namespaces, and make sure we can see the string macro declaration from the lower namespace.
139
126
let upperNamespace = MacroNamespace ( parent: middleNamespace, debugDescription: " upper " )
140
127
let upperStringDecl = try upperNamespace. declareStringMacro ( " StringMacro " )
141
- #expect( upperStringDecl != nil )
142
128
#expect( upperStringDecl. type == . string)
143
129
#expect( upperStringDecl === lowerStringDecl)
144
130
145
131
// Make sure we can also see the string list macro declaration from the middle namespace.
146
132
let upperStringListDecl = try upperNamespace. declareStringListMacro ( " StringListMacro " )
147
- #expect( upperStringListDecl != nil )
148
133
#expect( upperStringListDecl. type == . stringList)
149
134
#expect( upperStringListDecl === middleStringListDecl)
150
135
151
136
// Make sure we can also declare a boolean macro in the upper namespace.
152
137
let upperBooleanDecl = try upperNamespace. declareBooleanMacro ( " BooleanMacro " )
153
- #expect( upperBooleanDecl != nil )
154
138
#expect( upperBooleanDecl. type == . boolean)
155
139
156
140
// Make sure we cannot reach the upper-namespace boolean macro declaration if we do the lookup from either the lower or the middle namespace.
@@ -161,7 +145,6 @@ import SWBMacro
161
145
162
146
// Make sure we can also declare a path macro in the upper namespace.
163
147
let upperPathDecl = try upperNamespace. declarePathMacro ( " PathMacro " )
164
- #expect( upperPathDecl != nil )
165
148
#expect( upperPathDecl. type == . path)
166
149
167
150
// Make sure we cannot reach the upper-namespace path macro declaration if we do the lookup from either the lower or the middle namespace.
@@ -173,7 +156,6 @@ import SWBMacro
173
156
174
157
// Make sure we can also declare a path macro in the upper namespace.
175
158
let upperPathListDecl = try upperNamespace. declarePathListMacro ( " PathListMacro " )
176
- #expect( upperPathListDecl != nil )
177
159
#expect( upperPathListDecl. type == . pathList)
178
160
179
161
// Make sure we cannot reach the upper-namespace path list macro declaration if we do the lookup from either the lower or the middle namespace.
0 commit comments