adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
531 stars 128 forks source link

Terminal: getline in unittest causes trouble #196

Closed andre2007 closed 5 years ago

andre2007 commented 5 years ago

With version 2.3.0 this getline in unittest causes trouble:

https://github.com/adamdruppe/arsd/blob/9dd03c3158977038302feb9bb45cc6cd77bb89d5/terminal.d#L77

This is an issue as your library is at the moment added as sourceLibrary (in case of dub) or as direct source file in case of dmd. Therefore your unittests will be executed each time, the user unittests are executed.

For dub, also this issue will be disappear by changing the dub.json as proposed here: https://github.com/adamdruppe/arsd/issues/194#issuecomment-501976799 By changing the type from sourceLibrary to library in each subpackage, your unittests won't be triggered anymore during the unittets of the user.

adamdruppe commented 5 years ago

oh yeah that is really an example for documentation in the unittest to prove it compiles and runs. so prolly not a great unittest anyway because of the interactive part.

I am thinking about putting different versions on "unittests"; using the keyword for a few different things and version indicates the level of it. So a real unittest has no version, then examples that are more interactive are just like version(examples) or something too. (I just have to remember to actually do that version to ensure it works!)

andre2007 commented 5 years ago

The issue is solved for me (With recent dub.json changes, the unittests are now longer executed while I run my unittests). If you want you can close it or keep it open for your reference. The issue still occurs in cases where terminal.d is directly added.

adamdruppe commented 5 years ago

so I'm doing a fair amount of unittest changes pretty soon, prolly the end of this week we can close this with a new solution.

It might outright break dub test tho as a version things...

adamdruppe commented 5 years ago

I finally fixed this by putting them in version(demos) blocks. Then I can still compile and test them for the docs without messing up the ordinary tests.