assert return the value of the asserted expression
This commit is contained in:
@@ -314,9 +314,17 @@ class Macros {
|
||||
} else {
|
||||
b.str(basicMessage);
|
||||
};
|
||||
b.callSymbol("unless", [
|
||||
expression,
|
||||
b.callSymbol("throw", [messageExp])
|
||||
var letVal = b.symbol();
|
||||
b.callSymbol("let", [
|
||||
b.list([
|
||||
letVal,
|
||||
expression
|
||||
]),
|
||||
b.callSymbol("if", [
|
||||
letVal,
|
||||
letVal,
|
||||
b.callSymbol("throw", [messageExp])
|
||||
])
|
||||
]);
|
||||
};
|
||||
|
||||
|
@@ -44,8 +44,13 @@ class MacroTestCase extends Test {
|
||||
function testSetMacroVar() {
|
||||
_testSetMacroVar();
|
||||
}
|
||||
*/
|
||||
|
||||
function testTryCatchWithoutDynamic () {
|
||||
_testTryCatchWithoutDynamic();
|
||||
}
|
||||
|
||||
function testAssertReturnsValue () {
|
||||
_testAssertReturnsValue();
|
||||
}
|
||||
}
|
||||
|
@@ -95,4 +95,7 @@
|
||||
(try (throw "intended") (catch [e] (ReaderExp.StrExp e))))
|
||||
|
||||
(function _testTryCatchWithoutDynamic []
|
||||
(Assert.equals "intended" (_testTryCatchWithoutDynamicMacro)))
|
||||
(Assert.equals "intended" (_testTryCatchWithoutDynamicMacro)))
|
||||
|
||||
(function _testAssertReturnsValue []
|
||||
(Assert.equals true (assert true)))
|
Reference in New Issue
Block a user