Hey folks,
What is the preferred mechanism is for testing libraries that ship with Nim? I see some tests that use the unittest module:
https://github.com/Araq/Nim/blob/devel/tests/stdlib/thashes.nim
But the majority seem to define the expected output as a discarded string at the top of a test:
https://github.com/Araq/Nim/blob/devel/tests/stdlib/tcount.nim
And some seem to be using a 'doAssert' proc (template? macro?):
https://github.com/Araq/Nim/blob/devel/tests/stdlib/talgorithm.nim
I also found a commit that removes the unittest module from one file, which implies it is discouraged:
https://github.com/Araq/Nim/commit/75f232eb6efa1d213ca84c524ee9119da128d6e3
That seems counter intuitive to me; the suite/test structure provided by a test framework is more approachable, allows test writers to document exactly what they're checking, and provides natural divisions within a file for improved organization.
So, back to my original question: What is the preference? I searched the forums briefly, but couldn't find anything discussing this specifically.
Thanks!
If you look for a tool one very simple unit test library is described here: