<div dir="ltr"><div><div>I think Swift application testing has fairly different requirements from what traditional assertions provide. <br><br>Hard aborts work well for the language testing since if there are a language-level bugs we have no idea what state things are left in from test to test. They also work well for catching logic errors in programs (the classic use case for asserts).<br><br></div>I think if you want to build SwiftUnit (or whatever it would be called), it would probably need to use different mechanisms from the regular asserts.<br><br></div>- Tim<br><div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On 31 March 2015 at 10:25, Justin M Wozniak <span dir="ltr"><<a href="mailto:wozniak@mcs.anl.gov" target="_blank">wozniak@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
If assert failure always returns control to the OS, should we use some other symbol in the test suite? Or is managing testable code from Swift a bad idea? (This isn't just about core Swift tests, this is about supporting test-driven development in Swift.)<div class="HOEnZb"><div class="h5"><br>
<br>
On 03/28/2015 12:43 AM, Mihael Hategan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Right. I also think that a hard abort is the right choice. An assertion<br>
is a fundamental statement about program correctness. If that fails,<br>
there shouldn't be much of a point in continuing.<br>
<br>
In other news, we still need some kind of fault isolation and handling<br>
mechanism.<br>
<br>
Mihael<br>
<br>
On Fri, 2015-03-27 at 21:58 -0500, Tim Armstrong wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I feel like that is getting away from what assertions are intended to be -<br>
the best thing about them is that they're dead simple and have a clear,<br>
well-defined use case. I don't think that should be compromised out of a<br>
desire to have them serve dual purposes.<br>
<br>
- Tim<br>
<br>
On 27 March 2015 at 12:28, Justin M Wozniak <<a href="mailto:wozniak@mcs.anl.gov" target="_blank">wozniak@mcs.anl.gov</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Catchable/soft assertion failures would be useful if we rewrote the test<br>
suite in Swift. Maybe we should do that anyway.<br>
<br>
On 3/27/2015 9:39 AM, Tim Armstrong wrote:<br>
<br>
I don't think it makes sense to treat it as a soft error.<br>
<br>
The primary use case for assertions is the Swift/T test suite and there's<br>
no reason to continue running after an assertion failure.<br>
<br>
If a user wants to use them in their own scripts, they're intended to<br>
catch bugs or unintended behaviour. If an assertion fails, the script is<br>
not doing what it's meant to be doing. I don't see any reason to keep on<br>
running a buggy script that failed an assertion, and I see plenty of<br>
reasons not to keep it running.<br>
<br>
If users want to disable their assertions there is support for that.<br>
<br>
- Tim<br>
<br>
On 27 March 2015 at 09:20, Michael Wilde <<a href="mailto:wilde@anl.gov" target="_blank">wilde@anl.gov</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does "terminate immediately" need to always be immediate or should/could<br>
it integrate with the Swift/K notion of "soft errors"?<br>
<br>
I.e. an assert failure is treated like a failing function; that in turn<br>
as handled as the soft-error property specifies.<br>
- Mike<br>
<br>
<br>
<br>
On 3/25/15 10:24 PM, Tim Armstrong wrote:<br>
<br>
The program terminates immediately with an error message.<br>
<br>
There's a compile-time option to disable assertions if needed. It's<br>
actually a little weird in that it syntactically removes the statement - it<br>
doesn't evaluate the arguments to the funciton.<br>
<br>
- Tim<br>
<br>
On 25 March 2015 at 22:09, Mihael Hategan <<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
In Swift/T, what happens when an assertion fails?<br>
<br>
Mihael<br>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/<u></u>cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing listSwift-devel@ci.uchicago.<u></u>eduhttps://<a href="http://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">lists.ci.uchicago.<u></u>edu/cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
<br>
--<br>
Michael Wilde<br>
Mathematics and Computer Science Computation Institute<br>
Argonne National Laboratory The University of Chicago<br>
<br>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/<u></u>cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing listSwift-devel@ci.uchicago.<u></u>eduhttps://<a href="http://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">lists.ci.uchicago.<u></u>edu/cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
<br>
<br>
--<br>
Justin M Wozniak<br>
<br>
<br>
</blockquote>
______________________________<u></u>_________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/<u></u>cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
</blockquote>
<br>
</blockquote>
<br>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Justin M Wozniak<br>
<br>
</font></span></blockquote></div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 31 March 2015 at 10:25, Justin M Wozniak <span dir="ltr"><<a href="mailto:wozniak@mcs.anl.gov" target="_blank">wozniak@mcs.anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
If assert failure always returns control to the OS, should we use some other symbol in the test suite? Or is managing testable code from Swift a bad idea? (This isn't just about core Swift tests, this is about supporting test-driven development in Swift.)<div class="HOEnZb"><div class="h5"><br>
<br>
On 03/28/2015 12:43 AM, Mihael Hategan wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Right. I also think that a hard abort is the right choice. An assertion<br>
is a fundamental statement about program correctness. If that fails,<br>
there shouldn't be much of a point in continuing.<br>
<br>
In other news, we still need some kind of fault isolation and handling<br>
mechanism.<br>
<br>
Mihael<br>
<br>
On Fri, 2015-03-27 at 21:58 -0500, Tim Armstrong wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I feel like that is getting away from what assertions are intended to be -<br>
the best thing about them is that they're dead simple and have a clear,<br>
well-defined use case. I don't think that should be compromised out of a<br>
desire to have them serve dual purposes.<br>
<br>
- Tim<br>
<br>
On 27 March 2015 at 12:28, Justin M Wozniak <<a href="mailto:wozniak@mcs.anl.gov" target="_blank">wozniak@mcs.anl.gov</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Catchable/soft assertion failures would be useful if we rewrote the test<br>
suite in Swift. Maybe we should do that anyway.<br>
<br>
On 3/27/2015 9:39 AM, Tim Armstrong wrote:<br>
<br>
I don't think it makes sense to treat it as a soft error.<br>
<br>
The primary use case for assertions is the Swift/T test suite and there's<br>
no reason to continue running after an assertion failure.<br>
<br>
If a user wants to use them in their own scripts, they're intended to<br>
catch bugs or unintended behaviour. If an assertion fails, the script is<br>
not doing what it's meant to be doing. I don't see any reason to keep on<br>
running a buggy script that failed an assertion, and I see plenty of<br>
reasons not to keep it running.<br>
<br>
If users want to disable their assertions there is support for that.<br>
<br>
- Tim<br>
<br>
On 27 March 2015 at 09:20, Michael Wilde <<a href="mailto:wilde@anl.gov" target="_blank">wilde@anl.gov</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Does "terminate immediately" need to always be immediate or should/could<br>
it integrate with the Swift/K notion of "soft errors"?<br>
<br>
I.e. an assert failure is treated like a failing function; that in turn<br>
as handled as the soft-error property specifies.<br>
- Mike<br>
<br>
<br>
<br>
On 3/25/15 10:24 PM, Tim Armstrong wrote:<br>
<br>
The program terminates immediately with an error message.<br>
<br>
There's a compile-time option to disable assertions if needed. It's<br>
actually a little weird in that it syntactically removes the statement - it<br>
doesn't evaluate the arguments to the funciton.<br>
<br>
- Tim<br>
<br>
On 25 March 2015 at 22:09, Mihael Hategan <<a href="mailto:hategan@mcs.anl.gov" target="_blank">hategan@mcs.anl.gov</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
In Swift/T, what happens when an assertion fails?<br>
<br>
Mihael<br>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/<u></u>cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing listSwift-devel@ci.uchicago.<u></u>eduhttps://<a href="http://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">lists.ci.uchicago.<u></u>edu/cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
<br>
--<br>
Michael Wilde<br>
Mathematics and Computer Science Computation Institute<br>
Argonne National Laboratory The University of Chicago<br>
<br>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/<u></u>cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Swift-devel mailing listSwift-devel@ci.uchicago.<u></u>eduhttps://<a href="http://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">lists.ci.uchicago.<u></u>edu/cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
<br>
<br>
<br>
--<br>
Justin M Wozniak<br>
<br>
<br>
</blockquote>
______________________________<u></u>_________________<br>
Swift-devel mailing list<br>
<a href="mailto:Swift-devel@ci.uchicago.edu" target="_blank">Swift-devel@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-devel" target="_blank">https://lists.ci.uchicago.edu/<u></u>cgi-bin/mailman/listinfo/<u></u>swift-devel</a><br>
</blockquote>
<br>
</blockquote>
<br>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Justin M Wozniak<br>
<br>
</font></span></blockquote></div><br></div>