On 2012-03-12 15:08, Steven Schveighoffer wrote:
I contended that unit test asserts should result in a hook that by
default kills the program, but could be hooked into a unit testing
handler. But the consensus was just to switch back to the original
behavior (all asserts kill the program). If you
On 2012-03-12 15:08, Steven Schveighoffer wrote:
My thoughts on assert/unit test:
1. AssertError (and any other Error) should not be caught by normal user
code. Ever. It should only be caught by the runtime. However, the
handler in the runtime could provide a hook specific to the
OS/application
On Monday, March 12, 2012 09:40:44 Jacob Carlborg wrote:
> On 2012-03-11 22:12, Jonathan M Davis wrote:
> > On Sunday, March 11, 2012 13:13:58 Jacob Carlborg wrote:
> >> Yeah, exactly. And it feels a bit stupid to duplicate the assert
> >> statement just to throw something that isn't an AssertError
On Sat, 10 Mar 2012 01:09:02 -0500, Jonathan M Davis
wrote:
On Friday, March 09, 2012 22:48:25 Timon Gehr wrote:
On 03/09/2012 10:43 PM, Jonathan M Davis wrote:
...
>> Jonathan is just speculating. And I think he is wrong.
>
> Speculating about what?
>
> - Jonathan M Davis
About how assert
On Sat, 10 Mar 2012 11:03:43 -0500, Jacob Carlborg wrote:
On 2012-03-09 20:06, Jonathan M Davis wrote:
In what way? Yes, they're _catchable_, but everything that was on the
unwound
portion of the stack is now in an undefined state. So, recovering from
the
AssertError and continuing executi
On 2012-03-11 22:12, Jonathan M Davis wrote:
On Sunday, March 11, 2012 13:13:58 Jacob Carlborg wrote:
Yeah, exactly. And it feels a bit stupid to duplicate the assert
statement just to throw something that isn't an AssertError.
Not to say that it's what you have to do, but I _would_ point ou
On Sunday, March 11, 2012 13:13:58 Jacob Carlborg wrote:
> On 2012-03-10 18:08, Jonathan M Davis wrote:
> > I honestly don't think that Walter even considered unit testing frameworks
> > when he came up with the design. He built unit tests into the language.
> > So,
> > from his point of view, why
On 2012-03-10 18:08, Jonathan M Davis wrote:
I honestly don't think that Walter even considered unit testing frameworks
when he came up with the design. He built unit tests into the language. So,
from his point of view, why would you need a unit testing framework? He
probably didn't even conside
On 2012-03-10 17:58, Jonathan M Davis wrote:
2. As long as unit tests are properly isolated, then it's unlikely to be a big
issue, and even if it _is_ problem, it's only a problem as long as tests are
failing. So, while this may cause problems in some cases, it's still arguably
worth it, since t
On 2012-03-10 17:48, Jonathan M Davis wrote:
On Saturday, March 10, 2012 16:53:42 Jacob Carlborg wrote:
On 2012-03-09 18:59, H. S. Teoh wrote:
This opens up the question of, what's the *recommended* way of writing
unittests that check for these sorts of stuff?
For example, I believe in being t
On Sat, Mar 10, 2012 at 11:09:04AM -0800, Jonathan M Davis wrote:
> On Saturday, March 10, 2012 09:04:42 H. S. Teoh wrote:
[...]
> > Hmm. The more I think about it, the more I'm leaning towards
> > simplifying contracts so that most, if not all, of any complicated
> > checks happen in an external f
On Saturday, March 10, 2012 09:04:42 H. S. Teoh wrote:
> On Sat, Mar 10, 2012 at 08:48:32AM -0800, Jonathan M Davis wrote:
> > On Saturday, March 10, 2012 16:53:42 Jacob Carlborg wrote:
> > > On 2012-03-09 18:59, H. S. Teoh wrote:
> [.[..]
>
> > > > I agree, though, that catching Errors outside of
On Saturday, March 10, 2012 17:03:43 Jacob Carlborg wrote:
> On 2012-03-09 20:06, Jonathan M Davis wrote:
> > In what way? Yes, they're _catchable_, but everything that was on the
> > unwound portion of the stack is now in an undefined state. So, recovering
> > from the AssertError and continuing e
On Sat, Mar 10, 2012 at 08:48:32AM -0800, Jonathan M Davis wrote:
> On Saturday, March 10, 2012 16:53:42 Jacob Carlborg wrote:
> > On 2012-03-09 18:59, H. S. Teoh wrote:
[.[..]
> > > I agree, though, that catching Errors outside of unittests is a
> > > very, very bad idea in general.
> >
> > I don
On Saturday, March 10, 2012 16:52:43 Jacob Carlborg wrote:
> On 2012-03-09 17:56, Jonathan M Davis wrote:
> > The current implementation may not skip them, but if so, that might
> > actually be a bug. Errors are not intended to be recoverable, so you
> > can't rely on them hitting finally blocks, s
On Saturday, March 10, 2012 16:53:42 Jacob Carlborg wrote:
> On 2012-03-09 18:59, H. S. Teoh wrote:
> > This opens up the question of, what's the *recommended* way of writing
> > unittests that check for these sorts of stuff?
> >
> > For example, I believe in being thorough in unit tests, so I lik
On 2012-03-09 20:06, Jonathan M Davis wrote:
In what way? Yes, they're _catchable_, but everything that was on the unwound
portion of the stack is now in an undefined state. So, recovering from the
AssertError and continuing execution doesn't work. So, a handler can catch the
AssertError and do
On 2012-03-09 18:59, H. S. Teoh wrote:
This opens up the question of, what's the *recommended* way of writing
unittests that check for these sorts of stuff?
For example, I believe in being thorough in unit tests, so I like to use
them to verify that the complicated in-contract I just wrote actu
On 2012-03-09 17:56, Jonathan M Davis wrote:
The current implementation may not skip them, but if so, that might actually
be a bug. Errors are not intended to be recoverable, so you can't rely on them
hitting finally blocks, scope statements, or destructors. They may very well do
so at present.
On 2012-03-09 17:56, Jonathan M Davis wrote:
It was never intended that AssertError or any other Error be particularly
catchable, but it's also true that D is a systems programming language, so
it'll let you do stuff which is unsafe, so if you know what you're doing, then
there are circumstances
On Friday, March 09, 2012 22:48:25 Timon Gehr wrote:
> On 03/09/2012 10:43 PM, Jonathan M Davis wrote:
> ...
>
> >> Jonathan is just speculating. And I think he is wrong.
> >
> > Speculating about what?
> >
> > - Jonathan M Davis
>
> About how assertion failures affect struct destructors, final
On 03/09/2012 03:02 AM, Jonathan M Davis wrote:
> contorting your program to try and print assert
> messages to a file just because VisualD has problems with closing the
Window on
> you is a _bad_ idea IMHO.
Absolutely!
Inserting lines at the end of programs is not the correct solution to
th
On 03/09/2012 10:43 PM, Jonathan M Davis wrote:
...
Jonathan is just speculating. And I think he is wrong.
Speculating about what?
- Jonathan M Davis
About how assertion failures affect struct destructors, finally
statements and scope statements. If they wouldn't be executed upon
thrown A
On Friday, March 09, 2012 22:03:11 Timon Gehr wrote:
> On 03/09/2012 08:29 PM, H. S. Teoh wrote:
> > On Fri, Mar 09, 2012 at 01:37:38PM -0500, Jonathan M Davis wrote:
> >> On Friday, March 09, 2012 09:59:42 H. S. Teoh wrote:
> > [...]
> >
> >>> This opens up the question of, what's the *recommende
On 03/09/2012 08:29 PM, H. S. Teoh wrote:
On Fri, Mar 09, 2012 at 01:37:38PM -0500, Jonathan M Davis wrote:
On Friday, March 09, 2012 09:59:42 H. S. Teoh wrote:
[...]
This opens up the question of, what's the *recommended* way of
writing unittests that check for these sorts of stuff?
For exam
On 03/09/2012 07:37 PM, H. S. Teoh wrote:
On Fri, Mar 09, 2012 at 07:23:20PM +0100, Timon Gehr wrote:
On 03/09/2012 05:56 PM, Jonathan M Davis wrote:
[...]
It was never intended that AssertError or any other Error be
particularly catchable, but it's also true that D is a systems
programming la
On Fri, Mar 09, 2012 at 02:38:48PM -0500, Jonathan M Davis wrote:
> On Friday, March 09, 2012 11:29:43 H. S. Teoh wrote:
> > Hmph. Well, then that defeats the purpose of checking contracts,
> > because checking contracts is only justifiable if it's complex
> > enough, which means that it's liable t
On Friday, March 09, 2012 11:29:43 H. S. Teoh wrote:
> Hmph. Well, then that defeats the purpose of checking contracts, because
> checking contracts is only justifiable if it's complex enough, which
> means that it's liable to involve things like dtors and scope
> statements. It's silly to want to
On Fri, Mar 09, 2012 at 01:37:38PM -0500, Jonathan M Davis wrote:
> On Friday, March 09, 2012 09:59:42 H. S. Teoh wrote:
[...]
> > This opens up the question of, what's the *recommended* way of
> > writing unittests that check for these sorts of stuff?
> >
> > For example, I believe in being thoro
On Friday, March 09, 2012 19:23:20 Timon Gehr wrote:
> On 03/09/2012 05:56 PM, Jonathan M Davis wrote:
> > The current implementation may not skip them, but if so, that might
> > actually be a bug. Errors are not intended to be recoverable, so you
> > can't rely on them hitting finally blocks, scop
You are right, there is also an option to "Pause when program
finishes".
I never saw it until now. Thank you for all the replies.
On Friday, 9 March 2012 at 13:39:02 UTC, Dmitry Olshansky wrote:
On 09.03.2012 11:42, Chris Pons wrote:
I am new to D and have been playing around with Assert. I
f
On Friday, March 09, 2012 09:59:42 H. S. Teoh wrote:
> On Fri, Mar 09, 2012 at 08:56:10AM -0800, Jonathan M Davis wrote:
> > On Friday, March 09, 2012 16:07:10 Timon Gehr wrote:
> > > On 03/09/2012 03:24 PM, Jacob Carlborg wrote:
> [...]
>
> > > > I still want it to call finally blocks, scope stat
On Fri, Mar 09, 2012 at 07:23:20PM +0100, Timon Gehr wrote:
> On 03/09/2012 05:56 PM, Jonathan M Davis wrote:
[...]
> >It was never intended that AssertError or any other Error be
> >particularly catchable, but it's also true that D is a systems
> >programming language, so it'll let you do stuff wh
On 03/09/2012 05:56 PM, Jonathan M Davis wrote:
The current implementation may not skip them, but if so, that might actually
be a bug. Errors are not intended to be recoverable, so you can't rely on them
hitting finally blocks, scope statements, or destructors. They may very well do
so at present
On Fri, Mar 09, 2012 at 08:56:10AM -0800, Jonathan M Davis wrote:
> On Friday, March 09, 2012 16:07:10 Timon Gehr wrote:
> > On 03/09/2012 03:24 PM, Jacob Carlborg wrote:
[...]
> > > I still want it to call finally blocks, scope statements, and
> > > destructors.
> >
> > I have never actually obse
On Friday, March 09, 2012 16:07:10 Timon Gehr wrote:
> On 03/09/2012 03:24 PM, Jacob Carlborg wrote:
> > On 2012-03-09 15:13, Timon Gehr wrote:
> >> On 03/09/2012 01:20 PM, Jacob Carlborg wrote:
> >>> On 2012-03-09 12:12, Jonathan M Davis wrote:
> On Friday, March 09, 2012 11:03:38 Regan Heath
On 03/09/2012 03:24 PM, Jacob Carlborg wrote:
On 2012-03-09 15:13, Timon Gehr wrote:
On 03/09/2012 01:20 PM, Jacob Carlborg wrote:
On 2012-03-09 12:12, Jonathan M Davis wrote:
On Friday, March 09, 2012 11:03:38 Regan Heath wrote:
On Fri, 09 Mar 2012 08:20:33 -, Chris Pons
wrote:
Any idea
On 2012-03-09 15:13, Timon Gehr wrote:
On 03/09/2012 01:20 PM, Jacob Carlborg wrote:
On 2012-03-09 12:12, Jonathan M Davis wrote:
On Friday, March 09, 2012 11:03:38 Regan Heath wrote:
On Fri, 09 Mar 2012 08:20:33 -, Chris Pons wrote:
Any idea why, system("PAUSE") does work?
As Jonathan
On 03/09/2012 01:20 PM, Jacob Carlborg wrote:
On 2012-03-09 12:12, Jonathan M Davis wrote:
On Friday, March 09, 2012 11:03:38 Regan Heath wrote:
On Fri, 09 Mar 2012 08:20:33 -, Chris Pons wrote:
Any idea why, system("PAUSE") does work?
As Jonathan says, assert throws AssertError... which
On 09.03.2012 11:42, Chris Pons wrote:
I am new to D and have been playing around with Assert. I figured that
using a message with assert would be very helpful, but unfortunately
when the message is printed to the console, the console closes and my
program ends.
Is there any way to get a more pe
On 2012-03-09 12:12, Jonathan M Davis wrote:
On Friday, March 09, 2012 11:03:38 Regan Heath wrote:
On Fri, 09 Mar 2012 08:20:33 -, Chris Pons wrote:
Any idea why, system("PAUSE") does work?
As Jonathan says, assert throws AssertError... which means, if you wanted
to you could catch it, f
On Fri, 09 Mar 2012 11:12:44 -, Jonathan M Davis
wrote:
On Friday, March 09, 2012 11:03:38 Regan Heath wrote:
On Fri, 09 Mar 2012 08:20:33 -, Chris Pons wrote:
> Any idea why, system("PAUSE") does work?
As Jonathan says, assert throws AssertError... which means, if you
wanted
to y
On 3/9/2012 4:42 PM, Chris Pons wrote:
I am new to D and have been playing around with Assert. I figured that
using a message with assert would be very helpful, but unfortunately
when the message is printed to the console, the console closes and my
program ends.
Is there any way to get a more pe
On Friday, March 09, 2012 11:03:38 Regan Heath wrote:
> On Fri, 09 Mar 2012 08:20:33 -, Chris Pons wrote:
> > Any idea why, system("PAUSE") does work?
>
> As Jonathan says, assert throws AssertError... which means, if you wanted
> to you could catch it, for example...
>
> module asserting;
>
On Fri, 09 Mar 2012 08:20:33 -, Chris Pons wrote:
Any idea why, system("PAUSE") does work?
As Jonathan says, assert throws AssertError... which means, if you wanted
to you could catch it, for example...
module asserting;
import std.stdio;
import core.exception;
debug
{
import st
On Friday, March 09, 2012 10:55:10 Mars wrote:
> On Friday, 9 March 2012 at 07:55:56 UTC, Jonathan M Davis wrote:
> > What you should almost certainly be doing is changing Visual
> > Studio's settings
> > so that it doesn't close the Window when the program exits. I
> > know that it's
> > possible.
On Friday, 9 March 2012 at 07:55:56 UTC, Jonathan M Davis wrote:
What you should almost certainly be doing is changing Visual
Studio's settings
so that it doesn't close the Window when the program exits. I
know that it's
possible. I've done it, but I rarely use Windows, and I don't
remember wha
On Friday, March 09, 2012 09:20:33 Chris Pons wrote:
> Any idea why, system("PAUSE") does work?
Because that line never gets run. A failed assertion throws an AssertError
which skips everything until it gets handled by the runtime after it exits
main. So, if you have
assert(condition);
system("
Any idea why, system("PAUSE") does work?
Ok, thank you for the advice. I will look into it.
On Friday, March 09, 2012 08:42:25 Chris Pons wrote:
> I am new to D and have been playing around with Assert. I figured
> that using a message with assert would be very helpful, but
> unfortunately when the message is printed to the console, the
> console closes and my program ends.
>
> Is there
51 matches
Mail list logo