Closed metagn closed 1 year ago
Workaround runnableExamples"--import:std/assertions":
.
-d:nimPreviewSlimSystem
hasn't been enabled, so I'm not sure whether we should enforce the option for the runnableExamples
. Otherwise, a define should be generated instead
when defined(nimPreviewSlimSystem):
...
Then we would get "warning doAssert is about to move out of system". IMO instead of when defined(nimPreviewSlimSystem): import ...
we should use NimMajor >= 2
or defined(nimHasSlimSystemModules)
. Otherwise insane amounts of code will have a dependency on a "preview" define, meant to be phased out.
(Or add std/fatsystem
which exports all of them and check (compiles do: import std/fatsystem)
)
(Or make unknown imports a warningAsError by default and do {.push warning[UnknownImport]: off.}; import std/assertions; {.pop.}
which can be used universally for new modules)
Abstract
Automatically import std/assertions in runnableExamples blocks.
Motivation
Pretty much every runnableExamples block has an
assert
statement. Would save hundreds of lines of code to not have to explicitly import it in every single one.Description
Seems pretty self explanatory. Don't know about implementation details.
Code Examples
Backwards Compatibility
No response