Sorry for necrobumping, just wanted to note that [best 
practices](https://nim-lang.github.io/Nim/contributing.html#best-practices) 
paragraph from contributing guide recommends **assert** for runnableExamples 
currently:

> An exception to the above rule is runnableExamples and code-block rst blocks 
> intended to be used as runnableExamples, which for brevity use assert instead 
> of doAssert. Note that nim doc -d:danger main won't pass -d:danger to the 
> runnableExamples, but nim doc --doccmd:-d:danger main would, and so would the 
> second example below:
    
    
    runnableExamples:
      doAssert foo() # bad
      assert foo() # preferred
    
    
    Run

Personally, I'm of two minds about runnableExamples. Lower barrier for 
contributing testing, even interspersed with documentations is better than no 
tests at all. However, most of @arnetheduck's concerns are valid and I agree 
with @gemath:

> Some testing code is good example code, but not all of it, and vice versa.

For example, threading code is often not completely deterministic, so you jump 
through hoops to concoct tests based on assertions. Example code, on the other 
hand, should demonstrate idiomatic style and be plain and ordinary.

Reply via email to