digitalmars.D - version(unittest) in imported modules
- Peter Alexander (8/8) Mar 02 2014 dmd -unittest foo.d
- Dicebot (5/13) Mar 02 2014 Works as intended I say. With `rdmd -unittest foo.d` all test
- Peter Alexander (4/22) Mar 02 2014 Tests on imported modules are not always run otherwise everyone
- Dicebot (3/6) Mar 02 2014 Hm, I am surprised to find that you are right. That does not make
- Ivan Kazmenko (21/27) Mar 02 2014 Somewhat off topic, but this makes me wonder, what is the
- Peter Alexander (4/15) Mar 03 2014 Yes, that is what triggered the discussion :-) I'd like to run
dmd -unittest foo.d Then version(unittest) blocks will be run inside modules that `foo` imports, even though the unittests for those modules will not run. Two questions: 1. Is this a bug? 2. If not, how can I tell if unittests are running in *this* module?
Mar 02 2014
On Sunday, 2 March 2014 at 18:07:11 UTC, Peter Alexander wrote:dmd -unittest foo.d Then version(unittest) blocks will be run inside modules that `foo` imports, even though the unittests for those modules will not run. Two questions: 1. Is this a bug? 2. If not, how can I tell if unittests are running in *this* module?Works as intended I say. With `rdmd -unittest foo.d` all test from imported modules will be run, it just happens that raw dmd does not compile imports automatically. So your second question does not really make sense - all tests are always run everywhere.
Mar 02 2014
On Sunday, 2 March 2014 at 18:36:16 UTC, Dicebot wrote:On Sunday, 2 March 2014 at 18:07:11 UTC, Peter Alexander wrote:Tests on imported modules are not always run otherwise everyone would be constantly running phobos tests. rdmd is special in that automatically compiles imports.dmd -unittest foo.d Then version(unittest) blocks will be run inside modules that `foo` imports, even though the unittests for those modules will not run. Two questions: 1. Is this a bug? 2. If not, how can I tell if unittests are running in *this* module?Works as intended I say. With `rdmd -unittest foo.d` all test from imported modules will be run, it just happens that raw dmd does not compile imports automatically. So your second question does not really make sense - all tests are always run everywhere.
Mar 02 2014
On Sunday, 2 March 2014 at 19:37:47 UTC, Peter Alexander wrote:Tests on imported modules are not always run otherwise everyone would be constantly running phobos tests. rdmd is special in that automatically compiles imports.Hm, I am surprised to find that you are right. That does not make sense. static asserts from Phobos should trigger.
Mar 02 2014
On Sunday, 2 March 2014 at 21:03:12 UTC, Dicebot wrote:On Sunday, 2 March 2014 at 19:37:47 UTC, Peter Alexander wrote:Somewhat off topic, but this makes me wonder, what is the intended way of resolving these issues? (My guess is that they are what triggered the discussion anyway.) https://d.puremagic.com/issues/show_bug.cgi?id=12245 (BinaryHeap exhibits quadratic performance in debug mode) https://d.puremagic.com/issues/show_bug.cgi?id=12246 (RedBlackTree exhibits quadratic performance with -unittest command line option) Basically, when dealing with containers, a programmer can wish for two mutually exclusive ways: 1. (normal operation) The containers show the advertised asymptotic. 2. (paranoia) The containers are checking their integrity after each operation. This could help e.g. when then comparison function is flawed in some non-obvious way (is not transitive). A "-debug=BinaryHeap" seems like a good way to give 2. Perhaps the same can be done for RedBlackTree? Such checks are not exactly unit tests, they vary from one application of a container to another. Ivan Kazmenko.Tests on imported modules are not always run otherwise everyone would be constantly running phobos tests. rdmd is special in that automatically compiles imports.Hm, I am surprised to find that you are right. That does not make sense. static asserts from Phobos should trigger.
Mar 02 2014
On Monday, 3 March 2014 at 07:29:10 UTC, Ivan Kazmenko wrote:On Sunday, 2 March 2014 at 21:03:12 UTC, Dicebot wrote:Yes, that is what triggered the discussion :-) I'd like to run those tests only when phobos unit tests are running but I can't think of any way to conditionally enable the tests.On Sunday, 2 March 2014 at 19:37:47 UTC, Peter Alexander wrote:Somewhat off topic, but this makes me wonder, what is the intended way of resolving these issues? (My guess is that they are what triggered the discussion anyway.)Tests on imported modules are not always run otherwise everyone would be constantly running phobos tests. rdmd is special in that automatically compiles imports.Hm, I am surprised to find that you are right. That does not make sense. static asserts from Phobos should trigger.
Mar 03 2014