Re: throws(statement, ErrorType)

2011-01-23 Thread Jonathan M Davis
On Sunday 23 January 2011 00:47:13 bearophile wrote: spir: How to write a predicate like: assert( throws(someStatement, ErrorType) ); Are you using Design By Contract a lot? Contracts need to contain asserts only... Not necessarily. In fact, in general, the tact that has been taken

Re: throws(statement, ErrorType)

2011-01-23 Thread spir
On 01/23/2011 09:47 AM, bearophile wrote: spir: How to write a predicate like: assert( throws(someStatement, ErrorType) ); Are you using Design By Contract a lot? Contracts need to contain asserts only... Bye, bearophile No, not yet. I don't see your point. Denis

Re: throws(statement, ErrorType)

2011-01-23 Thread spir
that spir is looking for. Thank all for your answers. Seems I'll have to wait a bit. Pointer to the current code? (I'm very curious of how assertThrown works, actually asked about throws(statement, ErrorType) because I have no idea how to craft it myself. Seems to me needs compiler support to pass

Re: throws(statement, ErrorType)

2011-01-23 Thread Jonathan M Davis
be in the next release. assertThrown is the current name of the function that spir is looking for. Thank all for your answers. Seems I'll have to wait a bit. Pointer to the current code? (I'm very curious of how assertThrown works, actually asked about throws(statement, ErrorType) because I

Re: throws(statement, ErrorType)

2011-01-23 Thread spir
and then, then it'll be in the next release. assertThrown is the current name of the function that spir is looking for. Thank all for your answers. Seems I'll have to wait a bit. Pointer to the current code? (I'm very curious of how assertThrown works, actually asked about throws(statement

Re: throws(statement, ErrorType)

2011-01-23 Thread spir
and then, then it'll be in the next release. assertThrown is the current name of the function that spir is looking for. Thank all for your answers. Seems I'll have to wait a bit. Pointer to the current code? (I'm very curious of how assertThrown works, actually asked about throws(statement

Re: throws(statement, ErrorType)

2011-01-23 Thread Jonathan M Davis
very curious of how assertThrown works, actually asked about throws(statement, ErrorType) because I have no idea how to craft it myself. Seems to me needs compiler support to pass around the statement. Please, do not tell me it uses string mixins ;-) It uses lazy, not string mixins

Re: throws(statement, ErrorType)

2011-01-23 Thread bearophile
Jonathan M Davis: Not necessarily. In fact, in general, the tact that has been taken with Phobos is that you use assertions when you're verifying that Phobos is correct, and you use enforce (or an if-statement which throws an exception) when verifying that arguments given by outside code is

Re: throws(statement, ErrorType)

2011-01-23 Thread Jonathan M Davis
On Sunday 23 January 2011 09:24:25 bearophile wrote: Jonathan M Davis: Not necessarily. In fact, in general, the tact that has been taken with Phobos is that you use assertions when you're verifying that Phobos is correct, and you use enforce (or an if-statement which throws an exception)

throws(statement, ErrorType)

2011-01-22 Thread spir
How to write a predicate like: assert( throws(someStatement, ErrorType) ); ? Meaning a kind of builtin shortcut for: try: someStatement; throw new SomeCustomError(); catch (ErrorType _) {} that would also have the advantage of beeing usable as

Re: throws(statement, ErrorType)

2011-01-22 Thread Andrej Mitrovic
It's in that new std.unittest module that's coming in the next release. At least I think so, it was supposed to come with std.datetime, and that's scheduled for the next release.

Re: throws(statement, ErrorType)

2011-01-22 Thread Andrej Mitrovic
*There are several of those, like assertExcThrown, etc. Try searching the newsgroups for std.unittest or std.datetime and there should be a link to the source if you want it right now.

Re: throws(statement, ErrorType)

2011-01-22 Thread Jonathan M Davis
On Saturday 22 January 2011 20:45:14 Andrej Mitrovic wrote: *There are several of those, like assertExcThrown, etc. Try searching the newsgroups for std.unittest or std.datetime and there should be a link to the source if you want it right now. It's currently being reviewed and eventually vote