Assertions: Difference between revisions
Content added Content deleted
(→{{header|Perl}}: rearrangements) |
No edit summary |
||
Line 134:
MODULE Assertions;
VAR
PROCEDURE DoIt*;
BEGIN
END DoIt;
END Assertions.
Line 150:
Assertions.DoIt [0000001DH]
Kernel.Call [00001A7CH]
Meta.Item.ParamCallVal [00002B5EH]
</pre>
=={{header|D}}==
Line 429:
before 'Hello Universe'...
java.lang.AssertionError: This: Hello Universe is not the answer!. Expression: (it == 42). Values: it = Hello Universe
=={{header|Haskell}}==
Line 495:
julia> x::String
ERROR: type: typeassert: expected String, got Int32</lang>
=={{header|Lasso}}==
<lang lasso>local(a) = 8
fail_if(
#a != 42,
error_code_runtimeAssertion,
error_msg_runtimeAssertion + ": #a is not 42"
)</lang>
{{out}}
<pre>-9945 Runtime assertion: #a is not 42</pre>
=={{header|Lisaac}}==
<lang Lisaac>? { n = 42 };</lang>
Line 566 ⟶ 577:
class SampleClass
{
// there can be more than one condition per method
}</lang>
The design by contract macros throw <tt>Nemerle.AssertionException</tt>'s unless another Exception is specified using the <tt>otherwise</tt> keyword after the <tt>requires/ensures</tt> statement.
Line 588 ⟶ 599:
MODULE Assertions;
VAR
BEGIN
END Assertions.
</lang>
Line 990 ⟶ 1,001:
====Definition====
<lang vb>sub Assert( boolExpr, strOnFail )
end sub
</lang>
|