Used colon-less keyword syntax in method signatures where the optional variable name...
[cslatevm.git] / src / lib / assert.slate
blob080409e678f08c4347f47855a933150f2826998b
1 conditions define: #AssertionFailed &parents: {DescriptiveError}.
2 AssertionFailed description: 'Assertion Failed'.
4 c@(AssertionFailed traits) signalSaying: description
5 [description ifNil: [c signal] ifNotNil: [resend]].
7 _ assert: m@(Method traits) &description [m do ifFalse: [AssertionFailed signalSaying: description]].
9 _ deny: m@(Method traits) &description [m do ifTrue: [AssertionFailed signalSaying: description]].
11 _ assert: _@False &description [AssertionFailed signalSaying: description].
13 _ assert: _@True [].
15 x assert: expr@(Syntax Node traits) &description [x assert: expr evaluate &description: description].
17 node@(Syntax Node traits) assert: expr@(Syntax Node traits)
18 "A macro which (TODO: conditionally) expands into a run-time assertion."
20   Message sending: #assert: to: {node. expr}