Re: Review: A new stab at a potential std.unittests [Update]

2010-11-28 Thread Jacob Carlborg
On 2010-11-28 01:17, Jonathan M Davis wrote: On Saturday 27 November 2010 15:30:23 Jacob Carlborg wrote: On 2010-11-27 21:36, Jonathan M Davis wrote: On Saturday 27 November 2010 09:00:36 Jacob Carlborg wrote: On 2010-11-26 09:10, Jonathan M Davis wrote: Any more feedback on my potential

Re: Review: A new stab at a potential std.unittests [Update]

2010-11-27 Thread Jacob Carlborg
On 2010-11-26 09:10, Jonathan M Davis wrote: Any more feedback on my potential std.unittests, or is looking good overall? I definitely think that it's better than when I first posted it, so the feedback thus far has definitely been helpful, and I do find these functions extremely useful in my

Re: Review: A new stab at a potential std.unittests [Update]

2010-11-27 Thread Jonathan M Davis
On Saturday 27 November 2010 09:00:36 Jacob Carlborg wrote: On 2010-11-26 09:10, Jonathan M Davis wrote: Any more feedback on my potential std.unittests, or is looking good overall? I definitely think that it's better than when I first posted it, so the feedback thus far has definitely been

Re: Review: A new stab at a potential std.unittests [Update]

2010-11-27 Thread Jacob Carlborg
On 2010-11-27 21:36, Jonathan M Davis wrote: On Saturday 27 November 2010 09:00:36 Jacob Carlborg wrote: On 2010-11-26 09:10, Jonathan M Davis wrote: Any more feedback on my potential std.unittests, or is looking good overall? I definitely think that it's better than when I first posted it, so

Re: Review: A new stab at a potential std.unittests [Update]

2010-11-27 Thread Jonathan M Davis
On Saturday 27 November 2010 15:30:23 Jacob Carlborg wrote: On 2010-11-27 21:36, Jonathan M Davis wrote: On Saturday 27 November 2010 09:00:36 Jacob Carlborg wrote: On 2010-11-26 09:10, Jonathan M Davis wrote: Any more feedback on my potential std.unittests, or is looking good overall? I

Re: Review: A new stab at a potential std.unittests [Update]

2010-11-26 Thread Jonathan M Davis
Most recent code: http://is.gd/hO8HP Per the suggestions in this thread, I changed the string mixin templates to functions using lazy. I also added assertOpBinary and made assertOpOpAssign() call opOpAssign() directly. Finally, I made assertEqual() and assertNotEqual() templatized on a

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Jacob Carlborg
On 2010-11-21 01:23, Jonathan M Davis wrote: On Saturday 20 November 2010 08:03:52 Jacob Carlborg wrote: Why don't you use delegates instead of string mixins? For example, assertExcThrown, could take a delegate which calls the function you want to test instead of a string that represents the

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Jacob Carlborg
On 2010-11-21 02:34, Jonathan M Davis wrote: On Saturday 20 November 2010 16:23:32 Jonathan M Davis wrote: The lazy solution sounds pretty good actually. Can anyone think of any real downsides to that? So, it would look something like assertExcThrown(E : Throwable, T)(lazy T, string file =

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Jonathan M Davis
On Sunday 21 November 2010 04:19:51 Jacob Carlborg wrote: On 2010-11-21 02:34, Jonathan M Davis wrote: On Saturday 20 November 2010 16:23:32 Jonathan M Davis wrote: The lazy solution sounds pretty good actually. Can anyone think of any real downsides to that? So, it would look something

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Jacob Carlborg
On 2010-11-21 14:06, Jonathan M Davis wrote: On Sunday 21 November 2010 04:19:51 Jacob Carlborg wrote: On 2010-11-21 02:34, Jonathan M Davis wrote: On Saturday 20 November 2010 16:23:32 Jonathan M Davis wrote: The lazy solution sounds pretty good actually. Can anyone think of any real

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Jonathan M Davis
On Sunday 21 November 2010 05:44:15 Jacob Carlborg wrote: I don't know if the compiler can inline delegates or not but if it can I think this case would be very easy for the compiler to inline the delegate. It can't. That's one of the big issues with enforce. At the moment, it actually makes

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Lutger Blijdestijn
Jonathan M Davis wrote: On Saturday 20 November 2010 10:16:55 Lutger Blijdestijn wrote: I'm not particularly fond of this interface and think that a solution with a delegate / lazy or alias template parameter would be more convenient. However, until we have ast macros I do see the added value

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Lutger Blijdestijn
Jacob Carlborg wrote: On 2010-11-21 01:23, Jonathan M Davis wrote: On Saturday 20 November 2010 08:03:52 Jacob Carlborg wrote: Why don't you use delegates instead of string mixins? For example, assertExcThrown, could take a delegate which calls the function you want to test instead of a

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Jacob Carlborg
On 2010-11-21 17:20, Lutger Blijdestijn wrote: Jacob Carlborg wrote: On 2010-11-21 01:23, Jonathan M Davis wrote: On Saturday 20 November 2010 08:03:52 Jacob Carlborg wrote: Why don't you use delegates instead of string mixins? For example, assertExcThrown, could take a delegate which calls

Re: Review: A new stab at a potential std.unittests

2010-11-21 Thread Jonathan M Davis
On Sunday 21 November 2010 08:11:06 Lutger Blijdestijn wrote: Jonathan M Davis wrote: On Saturday 20 November 2010 10:16:55 Lutger Blijdestijn wrote: I'm not particularly fond of this interface and think that a solution with a delegate / lazy or alias template parameter would be more

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Fawzi Mohamed
On 19-nov-10, at 23:44, Sean Kelly wrote: Leandro Lucarella Wrote: Sean Kelly, el 19 de noviembre a las 14:59 me escribiste: This should work: void func(string x = __FILE__, T...)(T args); D allows defaulted template arguments to occur before non- defaulted ones. I wasn't aware that

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Jacob Carlborg
On 2010-11-19 19:16, Jonathan M Davis wrote: Updated code: http://is.gd/hqPb2 Okay. As mentioned before, I have helper unit test functions which I use heavily in std.datetime and which are pretty much going to have to either end up as private helper functions in std.datetime or actually get

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Lutger Blijdestijn
I'm not particularly fond of this interface and think that a solution with a delegate / lazy or alias template parameter would be more convenient. However, until we have ast macros I do see the added value in this approach. Some remarks about the api, not a proper review of the code itself: -

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Andrej Mitrovic
What about debug vs release compilation for this new module? We know we have assert for debug mode, and enforce for release mode (except the special assert false case). If I want assertExcThrown to be compiled in release mode it seems I'd need an enforced version of it, possibly called

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Jonathan M Davis
On Saturday 20 November 2010 08:03:52 Jacob Carlborg wrote: Why don't you use delegates instead of string mixins? For example, assertExcThrown, could take a delegate which calls the function you want to test instead of a string that represents the call. The mixin want be needed as well. Am I

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Jonathan M Davis
On Saturday 20 November 2010 10:16:55 Lutger Blijdestijn wrote: I'm not particularly fond of this interface and think that a solution with a delegate / lazy or alias template parameter would be more convenient. However, until we have ast macros I do see the added value in this approach.

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Jonathan M Davis
On Saturday 20 November 2010 10:23:36 Andrej Mitrovic wrote: What about debug vs release compilation for this new module? We know we have assert for debug mode, and enforce for release mode (except the special assert false case). If I want assertExcThrown to be compiled in release mode it

Re: Review: A new stab at a potential std.unittests

2010-11-20 Thread Jonathan M Davis
On Saturday 20 November 2010 16:23:32 Jonathan M Davis wrote: The lazy solution sounds pretty good actually. Can anyone think of any real downsides to that? So, it would look something like assertExcThrown(E : Throwable, T)(lazy T, string file = __FILE__, size_t line = __LINE__); Wait. No.

Review: A new stab at a potential std.unittests

2010-11-19 Thread Jonathan M Davis
Updated code: http://is.gd/hqPb2 Okay. As mentioned before, I have helper unit test functions which I use heavily in std.datetime and which are pretty much going to have to either end up as private helper functions in std.datetime or actually get added in a separate module for everyone to use

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Sean Kelly
Jonathan M Davis Wrote: In particular, needing to pass LineInfo() to assertExcThrown!() to know the file and line number was disliked (though it was by far the best solution that I'd been able to come up with). Not sure if this helps, but if you default-initialize template function

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Jonathan M Davis
On Friday, November 19, 2010 11:37:16 Sean Kelly wrote: Jonathan M Davis Wrote: In particular, needing to pass LineInfo() to assertExcThrown!() to know the file and line number was disliked (though it was by far the best solution that I'd been able to come up with). Not sure if this

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Sean Kelly
Jonathan M Davis Wrote: On Friday, November 19, 2010 11:37:16 Sean Kelly wrote: Jonathan M Davis Wrote: In particular, needing to pass LineInfo() to assertExcThrown!() to know the file and line number was disliked (though it was by far the best solution that I'd been able to come up

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Jonathan M Davis
On Friday 19 November 2010 11:59:18 Sean Kelly wrote: Jonathan M Davis Wrote: On Friday, November 19, 2010 11:37:16 Sean Kelly wrote: Jonathan M Davis Wrote: In particular, needing to pass LineInfo() to assertExcThrown!() to know the file and line number was disliked (though it was

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Leandro Lucarella
Sean Kelly, el 19 de noviembre a las 14:59 me escribiste: Jonathan M Davis Wrote: On Friday, November 19, 2010 11:37:16 Sean Kelly wrote: Jonathan M Davis Wrote: In particular, needing to pass LineInfo() to assertExcThrown!() to know the file and line number was disliked (though it

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Jonathan M Davis
On Friday 19 November 2010 12:39:20 Leandro Lucarella wrote: Sean Kelly, el 19 de noviembre a las 14:59 me escribiste: Jonathan M Davis Wrote: On Friday, November 19, 2010 11:37:16 Sean Kelly wrote: Jonathan M Davis Wrote: In particular, needing to pass LineInfo() to

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Sean Kelly
Leandro Lucarella Wrote: Sean Kelly, el 19 de noviembre a las 14:59 me escribiste: This should work: void func(string x = __FILE__, T...)(T args); D allows defaulted template arguments to occur before non-defaulted ones. And what is func!(blah)(); is supposed to do, make x =

Re: Review: A new stab at a potential std.unittests

2010-11-19 Thread Leandro Lucarella
Jonathan M Davis, el 19 de noviembre a las 13:24 me escribiste: On Friday 19 November 2010 12:39:20 Leandro Lucarella wrote: Sean Kelly, el 19 de noviembre a las 14:59 me escribiste: Jonathan M Davis Wrote: On Friday, November 19, 2010 11:37:16 Sean Kelly wrote: Jonathan M Davis