digitalmars.D.learn - More elaborate asserts in unittests?
- IGotD- (4/4) Oct 21 2020 When an assert fails in a unittest, I only get which line that
- Adam D. Ruppe (2/6) Oct 21 2020 try compiling with dmd -checkaction=context
- IGotD- (7/8) Oct 21 2020 Thanks, that was simple and it worked. Speaking of this,
- bachmeier (4/14) Oct 21 2020 Click the "Improve this page" link in the upper right corner and
- IGotD- (2/5) Oct 21 2020 Will do, thank you for the direction.
- Mathias LANG (4/14) Oct 21 2020 Unfortunately this switch still has some bugs, so you can easily
- MoonlightSentinel (10/13) Oct 22 2020 Which is more of a template emission problem because
When an assert fails in a unittest, I only get which line that failed. However, it would be very useful to see what the values are on either side of the unary boolean expression. Is this possible?
Oct 21 2020
On Wednesday, 21 October 2020 at 22:30:11 UTC, IGotD- wrote:When an assert fails in a unittest, I only get which line that failed. However, it would be very useful to see what the values are on either side of the unary boolean expression. Is this possible?try compiling with dmd -checkaction=context
Oct 21 2020
On Wednesday, 21 October 2020 at 22:41:42 UTC, Adam D. Ruppe wrote:try compiling with dmd -checkaction=contextThanks, that was simple and it worked. Speaking of this, shouldn't this be documented here for example. https://dlang.org/spec/unittest.html Just adding a friendly tip that -checkaction=context gives the user more information. I couldn't find this information anywhere.
Oct 21 2020
On Wednesday, 21 October 2020 at 22:48:04 UTC, IGotD- wrote:On Wednesday, 21 October 2020 at 22:41:42 UTC, Adam D. Ruppe wrote:Click the "Improve this page" link in the upper right corner and add what you think needs to be there. Those PRs usually get a fast response.try compiling with dmd -checkaction=contextThanks, that was simple and it worked. Speaking of this, shouldn't this be documented here for example. https://dlang.org/spec/unittest.html Just adding a friendly tip that -checkaction=context gives the user more information. I couldn't find this information anywhere.
Oct 21 2020
On Wednesday, 21 October 2020 at 23:54:41 UTC, bachmeier wrote:Click the "Improve this page" link in the upper right corner and add what you think needs to be there. Those PRs usually get a fast response.Will do, thank you for the direction.
Oct 21 2020
On Wednesday, 21 October 2020 at 22:48:04 UTC, IGotD- wrote:On Wednesday, 21 October 2020 at 22:41:42 UTC, Adam D. Ruppe wrote:Unfortunately this switch still has some bugs, so you can easily run into linker errors. I'm hoping to ultimately make it the default though.try compiling with dmd -checkaction=contextThanks, that was simple and it worked. Speaking of this, shouldn't this be documented here for example. https://dlang.org/spec/unittest.html Just adding a friendly tip that -checkaction=context gives the user more information. I couldn't find this information anywhere.
Oct 21 2020
On Thursday, 22 October 2020 at 04:20:35 UTC, Mathias LANG wrote:Unfortunately this switch still has some bugs, so you can easily run into linker errors. I'm hoping to ultimately make it the default though.Which is more of a template emission problem because `-checkaction=context` uses a templated hook in druntime (`core.internal.dassert._d_assert_fail`). `-checkaction=context` should support any unary and binary expression and properly format all data types (unless we've missed some special case). Note that it currently does not support complex expressions (e.g `assert(0 <= a && a < 10);` but I/someone else might implement that in the future.
Oct 22 2020