Differences From Artifact [b9b84a35fccc5116]:
- File
tricks/test.d
- 2010-11-20 09:20:03 - part of checkin [515502e8d1] on branch trunk - table get, init, ask expressions addded (user: kinaba) [annotate]
To Artifact [3ba75b9c3bef69b2]:
- File
tricks/test.d
- 2010-11-21 08:33:47 - part of checkin [6ecc7046fc] on branch trunk - tableset x{y:1} expression added (user: kinaba) [annotate]
100 100 assert_throw!AssertError( assert_throw!Error(nothing()) );
101 101 assert_nothrow ( assert_throw!Error(assertError()) );
102 102 assert_throw!AssertError( assert_throw!AssertError(error()) );
103 103 }
104 104
105 105 template assertOp(string op)
106 106 {
107 - void assertOp(A, B, string fn=__FILE__, size_t ln=__LINE__)(A a, B b, string msg="")
107 + void assertOp(A, B, string fn=__FILE__, size_t ln=__LINE__)(lazy A a_, lazy B b_, string msg="")
108 108 {
109 109 try
110 - { if( mixin("a"~op~"b") ) return; }
110 + { A a=a_(); B b=b_(); if( mixin("a"~op~"b") ) return;
111 + onAssertErrorMsg(fn, ln, msg.length ? msg : text(a, " !", op, " ", b)); }
111 112 catch(Throwable e)
112 113 { onAssertErrorMsg(fn, ln, msg.length ? msg : "bad exception \n >> "~e.toString()); }
113 - onAssertErrorMsg(fn, ln, msg.length ? msg : text(a, " !", op, " ", b));
114 + assert(false);
114 115 }
115 116 }
116 117
117 118 alias assertOp!(`==`) assert_eq; /// asserts two operands are ==
118 119 alias assertOp!(`!=`) assert_ne; /// asserts two operands are !=
119 120 alias assertOp!(`<`) assert_lt; /// asserts two operands are <
120 121 alias assertOp!(`<=`) assert_le; /// asserts two operands are <=