Differences From Artifact [314aad0104b85557]:
- File
tricks/test.d
- 2010-11-09 07:27:21 - part of checkin [0f02103885] on branch trunk - let, var, def became layer-neutral definition (not @val). scope splitting (let x=1;let x=2;let y=(let x=3);x is 1) is correctly implemented now. (user: kinaba) [annotate]
To Artifact [09cc57fcd7c969ca]:
- File
tricks/test.d
- 2010-11-09 14:24:09 - part of checkin [2459e9a821] on branch trunk - refactored eof-driven REPL (user: kinaba) [annotate]
13 13 void assert_throw(ExceptionType, T, string fn=__FILE__, size_t ln=__LINE__)(lazy T t, string msg="")
14 14 {
15 15 try
16 16 { t(); }
17 17 catch(ExceptionType)
18 18 { return; }
19 19 catch(Throwable e)
20 - { onAssertErrorMsg(fn, ln, msg.length ? msg : "exception ["~e.toString()~"]"); }
21 - onAssertErrorMsg(fn, ln, msg.length ? msg : "no execption");
20 + { onAssertErrorMsg(fn, ln, msg.length ? msg : "bad exception\n >> "~e.toString()); }
21 + onAssertErrorMsg(fn, ln, msg.length ? msg : "not thrown");
22 22 }
23 23
24 24 /// Unittest helper that asserts an expression must not throw anything
25 25
26 26 auto assert_nothrow(T, string fn=__FILE__, size_t ln=__LINE__)(lazy T t, string msg="")
27 27 {
28 28 try
29 29 { return t(); }
30 30 catch(Throwable e)
31 - { onAssertErrorMsg(fn, ln, msg.length ? msg : "exception ["~e.toString()~"]"); }
31 + { onAssertErrorMsg(fn, ln, msg.length ? msg : "bad exception\n >> "~e.toString()); }
32 32 assert(false);
33 33 }
34 34
35 35 unittest
36 36 {
37 37 auto error = {throw new Error("hello");};
38 38 auto nothing = (){};