File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -109,18 +109,22 @@ template skip*(reason: string): untyped =
109
109
110
110
proc asis_id[P: proc](x: P): P = x
111
111
112
- template skipIf*(condition: bool , reason: string ) =
112
+ template skipIf*(condition: bool , reason: string ): proc =
113
113
bind asis_id, skip
114
- if condition:
115
- return skip(reason)
116
- return asis_id
114
+ if condition: skip(reason)
115
+ else: asis_id
116
+
117
+ template doIf(cond: bool ; body) =
118
+ if cond: body
119
+ template doIf(cond: static bool ; body) =
120
+ when cond: body
117
121
118
122
template skipIf*(condition: bool , reason: string ; body) =
123
+ bind doIf
119
124
addSkip reason
120
- if not condition:
121
- body
125
+ doIf not condition, body
122
126
123
- template skipUnless*(condition: bool , reason: string ) =
127
+ template skipUnless*(condition: bool , reason: string ): proc =
124
128
bind skipIf
125
129
skipIf(not condition, reason)
126
130
You can’t perform that action at this time.
0 commit comments