[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2011-03-21 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 Jonathan M Davis changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #16 from Andrej Mitrovic 2010-08-17 16:00:36 PDT --- Nicely done with the formatting and documentation, I hope it gets added. I can confirm that the unittests run fine now. -- Configure issuemail: http://d.puremagic.com/issues/us

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #15 from Jonathan M Davis 2010-08-17 15:57:03 PDT --- @Andrej size_t is an alias appropriate for whatever your architecture is. IIRC, it's the same size as pointers are, but I'm not 100% sure on that. It's also the type used for i

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #14 from Jonathan M Davis 2010-08-17 15:48:08 PDT --- Created an attachment (id=722) Implementation for assertExcThrown() and assertExcNotThrown() Thanks, to Andrej's help, I think that I have an acceptable, working version of the

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #13 from Andrej Mitrovic 2010-08-17 12:41:48 PDT --- (In reply to comment #11) > I'm not sure that I understand your question about the msg parameter. If you > put it in with the function arguments, then you _have_ to give a messag

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #12 from Jonathan M Davis 2010-08-17 12:10:30 PDT --- Oh, and for correctness' sake, I believe that __LINE__ is in fact size_t, not uint. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You a

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #11 from Jonathan M Davis 2010-08-17 12:08:49 PDT --- I'm not sure that I understand your question about the msg parameter. If you put it in with the function arguments, then you _have_ to give a message every time because you can'

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-17 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #10 from Andrej Mitrovic 2010-08-17 08:04:24 PDT --- I have a revamped edition, this one is much nicer: void assertExceptionThrown(alias E, alias func, T...)(lineFile info, T args) if(__traits(compiles, {try{}catch(E e){}})) {

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #9 from Andrej Mitrovic 2010-08-16 13:04:56 PDT --- Good news, I've found a way to pass __LINE__ and __FILE__. It's a tad bit ugly and uses a struct, I haven't been able to call a struct's custom constructor without calling it with

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #8 from Andrej Mitrovic 2010-08-16 11:23:52 PDT --- Ah I see the problem now. __FILE__ and __LINE__ can be used to initialize a parameter as a default value, but the only way they can be optional is if they're the last parameters o

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #7 from Andrej Mitrovic 2010-08-16 06:55:46 PDT --- Nice work! Btw, don't templates already have __FILE__ and __LINE__ ? See here: http://www.digitalmars.com/d/2.0/template.html Under "Template Value Parameters" it states "The

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-16 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #6 from Jonathan M Davis 2010-08-16 01:03:07 PDT --- Thanks for the help. One thing that I'm finding you need with these types of functions though is the file and line number. Otherwise, tracking down the problem can be quite hard.

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #5 from Andrej Mitrovic 2010-08-15 14:36:13 PDT --- I meant "general", not "gerenal". And when I talk about "first line" and "second line", I mean the ones in the willThrow function. -- Configure issuemail: http://d.puremagic.com

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #4 from Andrej Mitrovic 2010-08-15 14:34:21 PDT --- There we go, this should now work: import std.stream, std.stdio; void assertExceptionThrown(alias func, alias exc, T...)(T args) { auto funcName = __traits(identifier, func

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #3 from Andrej Mitrovic 2010-08-15 14:14:28 PDT --- Sorry, that still won't work. I haven't made sure that the function *must* throw an exception. I'll work on it some more, stand by.. :) -- Configure issuemail: http://d.puremagi

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 Andrej Mitrovic changed: What|Removed |Added CC||andrej.mitrov...@gmail.com --- Comme

[Issue 4644] assertExceptionThrown to assert that a particular exception was thrown

2010-08-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4644 --- Comment #1 from Jonathan M Davis 2010-08-15 01:49:07 PDT --- A useful counterpart might be assertExceptionNotThrown, though I think that an exception escaping the unittest block equates to test failure, so I'm not sure that it would be nec