Nim/tests
Alexander Ivanov 672dc5cd87
Nil type check implementation (#15287)
* Nil checking
* Enable current older not nil checking again, run new checking only under flag, skip our test
* Enable tests, work on try/except and bugs, fix notnil tests

* Enable strictNotNil tests (currently with lowercase category) and add some expected output
* Work on try/except/finally: still some things unclear and a lot of code can raise out of try
* Fix the notnil build by going back to the old version of a test which I shouldn't have changed

* Fix test : use action compile
* Work on mutation and aliasing: not finished
* Render var parititions graph, try to understand it, fix a nilcheck if bug
* Rebase, progress on working with partitions
* Improve time logic
* Fix some bugs, use graph indices instead of symbol in nil map
* Fix bugs, test simpler ident aliasing for now, support two mutation levels
* Support ContentMutation and ReAssignment: for now just detect possible re assignment for var parameters of calls
* Enable several simple passing tests
* Cleanup a bit, fix condition/branch infix-related bug
* Remove some files, address some comments by Araq
* Use internalError and no quit for now
* Separate tests with expected warnings and with expected ok, fix a bug with if with a single branch related to copyMap
* Fix new data structures, bugs: make tests pass, disable some for now
* Work on fixing errors with non-sym nodes, aliasing: tests fail
* Work on alias support: simple set-based logic, todo more tests and ref sets?
* Use ref sets: TODO can we think of handle seq-s similar to varpartitions' Araq ones
* Handle defers in one place, stop raising in reverse to make an async test compile with strictNotNil, add a commented out test
* Dot expressions: call/reassignment. Other refactorings and distinct, SeqOfDistinct support. Checkout an older varpartitions
* Work on field tracking
* Backup : trying to fix bugs when running some stdlib stuff for running an async test
* Start a section about strict not nil checking in experimental manual
* Fix experimental strict not nil manual section and move it to another file based on Araq feedback
* Fix unstructured flow and double warning problems, fix manual, cleanup
* Fix if/elif/else : take in account structure according to Araq feedback
* Refactor a bit
* Work on bracket expr support, re-enable tests, clarify in manual/tests/implementation static index support for now
* Work on compiling stdlib and compiler with strictNotNil
* Small fixes to the manual for strictNotNil
* Fix idgen for strict check nil rebase
* Enable some simple tests, remove old stuff, comment out code/print
* Copy the original varpartitions source instead of my changes
* Remove some files
2020-12-29 10:31:11 +01:00
..
actiontable Merge tests into a larger file (part 1 of ∞) (#9318) 2018-10-12 17:02:46 +02:00
alias
align testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343) 2020-12-14 10:58:29 +01:00
ambsym require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
arc use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
arithm fix operators containing percent for VM usage (#13536) 2020-03-11 01:01:25 +01:00
array fix #16025 repr now consistent: does not insert trailing newline (#16034) 2020-11-19 12:12:51 -08:00
assert init checks and 'out' parameters (#14521) 2020-06-23 10:53:57 +02:00
assign use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
astoverload
astspec styleCheck: Fix error for sugar and std/with (#16176) 2020-12-02 20:48:16 +01:00
async use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
bind Add testcases for #11811 and #14315 (#14726) 2020-06-19 14:56:38 +02:00
borrow Add testcase for #14440 (#14771) 2020-06-23 14:17:12 +02:00
casestmt nimout now consistently uses nimoutCheck (#16189) 2020-12-01 21:12:40 +01:00
ccgbugs use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
ccgbugs2 testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343) 2020-12-14 10:58:29 +01:00
clearmsg require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
closure testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343) 2020-12-14 10:58:29 +01:00
cnstseq require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
collections use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
compilepragma fixes #10299 (#11324) 2019-05-25 07:33:33 +02:00
compiler use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
compilerapi nimeval errorHook support (#15255) 2020-09-07 20:05:07 +02:00
compilerfeatures new compiler feature: --expandMacro 2019-05-29 20:47:28 +02:00
compiles delete list comprehension (#12392) 2019-11-22 19:57:43 +01:00
concat
concepts make megatest consistent with unjoined tests wrt newlines, honor newlines in output spec (#16151) 2020-11-28 09:09:31 +01:00
constr Add testcase for #10465 (#14943) 2020-07-09 01:51:18 +02:00
constraints require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
constructors Turn some of the errors back into warnings 2020-04-01 19:38:44 +02:00
controlflow Make unreachable code a warning instead of an error (#14816) 2020-06-29 08:49:53 +02:00
converter add testcase for #9165 (#15787) 2020-10-30 09:57:02 +01:00
coroutines testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343) 2020-12-14 10:58:29 +01:00
cpp testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343) 2020-12-14 10:58:29 +01:00
defaultprocparam Add testcase for #12252 (#15676) 2020-10-22 12:51:03 +02:00
deprecated fix #11009 (#14935) 2020-07-09 09:57:35 +02:00
deps Correct all eggs (#15906) 2020-11-10 21:53:25 +01:00
destructor use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
dir with space fixes #10042 (allow spaces in import) (#10504) 2019-01-31 08:20:00 +01:00
discard improve the 'has to be discarded' error message 2020-05-02 22:31:19 +02:00
distinct Make {.requiresInit.} to work for distinct types (#15869) 2020-11-06 18:56:09 +00:00
distros fix tdistros test which was failing on Nightlies 2020-04-28 15:59:32 +02:00
dll fix #16265; fix #13999 (HCR on OSX); cgen now does not line wrap string litterals (#16329) 2020-12-14 11:17:24 +01:00
effects rationals.nim: Use func everywhere (#16302) 2020-12-09 16:17:50 +01:00
enum fix #15145 (#15816) 2020-11-02 08:56:51 +01:00
errmsgs strutils.nim: Use func everywhere (#16281) 2020-12-07 17:07:12 +01:00
exception Make 'echo' raise IOErrors when appropriate (#16367) 2020-12-18 10:06:13 +01:00
exprs update tests that tested for the 'discard' error messages 2020-05-02 22:31:19 +02:00
fields use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
flags testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343) 2020-12-14 10:58:29 +01:00
float fix #16469 vm float constants: do not conflate -0.0 and 0.0 (#16470) 2020-12-27 14:35:01 +01:00
fragmentation tests: disable flaky tests for now; closes #9421 2018-10-18 12:12:15 +02:00
friends
gc follow #15860 clean cgi module (#16487) 2020-12-27 19:46:21 +01:00
generics use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
gensym fixes yet another gensym regression (#12145) 2019-09-06 00:45:00 +02:00
global require errormsg to be specified before file. 2018-12-11 21:23:21 +01:00
ic Incremental compilation (IC): Improvements (#11881) 2019-08-08 08:41:05 +02:00
implicit lots of small changes 2018-12-11 21:23:22 +01:00
import_in_config
init init checks and 'out' parameters (#14521) 2020-06-23 10:53:57 +02:00
isolate 'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011) 2020-07-20 07:50:19 +02:00
iter testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343) 2020-12-14 10:58:29 +01:00
js unittest: use defines instead of env vars (#16165) 2020-12-10 00:57:52 +01:00
lent testament spec: remove errmsg alias of errormsg (#16188) 2020-11-29 17:32:34 -08:00
let Allow let to not have value when using importc (#14258) 2020-05-12 20:28:18 +02:00
lexer use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
lookups make megatest consistent with unjoined tests wrt newlines, honor newlines in output spec (#16151) 2020-11-28 09:09:31 +01:00
macros fix broken => for typed procs with pragmas (#16190) 2020-12-01 12:01:36 +01:00
magics make megatest consistent with unjoined tests wrt newlines, honor newlines in output spec (#16151) 2020-11-28 09:09:31 +01:00
manyloc fixed article duplication typos (#16216) 2020-12-02 09:15:29 +01:00
metatype use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
method Error -> Defect for defects (#13908) 2020-04-28 19:56:01 +02:00
misc use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
modules refactorings to prepare the compiler for IC (#15935) 2020-12-17 08:01:36 +01:00
namedparams fixes #12196 2019-09-16 12:12:44 +02:00
newconfig use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
nimble testament spec: remove errmsg alias of errormsg (#16188) 2020-11-29 17:32:34 -08:00
nimdoc fix #15916 (#15917) [backport] 2020-11-12 09:31:35 +01:00
niminaction use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
notnil Add tests for #8481, #6490 and #4061 (#14083) 2020-04-23 19:52:33 +02:00
objects remove some noises in tests (#16448) 2020-12-27 14:45:57 +01:00
objvariant use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
openarray clean up deprecated stuff and unused imports in tests (#13059) 2020-01-07 09:49:08 +01:00
osproc use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
overflw Fix #15706 (#15846) 2020-11-07 08:00:41 +00:00
overload make megatest consistent with unjoined tests wrt newlines, honor newlines in output spec (#16151) 2020-11-28 09:09:31 +01:00
package_level_objects
parallel workaround #15725 disable freebsd tblocking_channel.nim (#15726) 2020-10-26 10:53:39 +02:00
parser use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
pragmas use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
proc testament spec: remove errmsg alias of errormsg (#16188) 2020-11-29 17:32:34 -08:00
procvar Merge tests into a larger file (part 5 of ∞) (#9368) 2018-10-16 10:50:10 +02:00
range Error -> Defect for defects (#13908) 2020-04-28 19:56:01 +02:00
rational Error -> Defect for defects (#13908) 2020-04-28 19:56:01 +02:00
realtimeGC fixed article duplication typos (#16216) 2020-12-02 09:15:29 +01:00
sets use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
showoff Clean up macros (#14959) 2020-07-14 16:44:56 +02:00
specialops make megatest consistent with unjoined tests wrt newlines, honor newlines in output spec (#16151) 2020-11-28 09:09:31 +01:00
statictypes use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
stdlib RST: fix directive with fields (#16490) (#16493) 2020-12-29 03:32:11 +01:00
stmt fix #15972 (#15994) 2020-11-18 00:14:14 +00:00
strictnotnil Nil type check implementation (#15287) 2020-12-29 10:31:11 +01:00
system remove some noises in tests (#16448) 2020-12-27 14:45:57 +01:00
template remove some noises in tests (#16448) 2020-12-27 14:45:57 +01:00
testament fix #16330 tshould_not_work (#16342) 2020-12-14 11:37:27 +01:00
testdata
threads faster CIs (#13803) 2020-03-30 13:18:12 +02:00
tools new feature: --staticBoundChecks:on to enforce static array index checking (#10965) 2020-03-18 14:25:10 +01:00
trmacros Reenable a few tests 2020-07-14 19:50:42 +02:00
tuples cleanup old codes (#16173) 2020-11-30 09:41:50 +08:00
typerel Reenable a few tests 2020-07-14 19:50:42 +02:00
types use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
untestable Deprecate and/or remove ospaths (#14767) 2020-06-23 10:51:33 +02:00
usingstmt Clean up macros (#14959) 2020-07-14 16:44:56 +02:00
valgrind fix #15631 (#15632) 2020-10-19 22:25:43 +02:00
varres testament spec: remove errmsg alias of errormsg (#16188) 2020-11-29 17:32:34 -08:00
varstmt Testament: refactoring; makes the test joiner green 2018-12-11 21:23:23 +01:00
views ensure the Nim compiler works with --experimental:strictFuncs --experimental:views [backport:1.4] (#15737) 2020-10-26 21:08:57 +01:00
vm use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
ast_pattern_matching.nim add tastspec (and ast_pattern_matching) (#10863) 2019-03-19 11:45:29 +01:00
config.nims unittest: use defines instead of env vars (#16165) 2020-12-10 00:57:52 +01:00
dummy.txt Remove install.txt and readme.txt (#9521) 2018-10-28 13:36:52 +01:00
js.html
js.nim
m14634.nim use doAssert in tests (#16486) 2020-12-28 14:13:21 +01:00
mmaptest.nim Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
readme.md Update link to parseSpec proc 2020-06-28 00:13:54 +02:00
rectest.nim
stckovfl.nim
test_nimscript.nims doAssertRaises improvements; nimscript supports except Exception as e (#15765) 2020-11-12 09:25:41 +01:00

This directory contains the test cases.

Each test must have a filename of the form: t*.nim

Note: Testament is only aware of tests under a directory (eg tests/foo/) and will ignore top-level tests like tests/tbar.nim.

Specs

Each test can contain a spec in a discard """ ... """ block.

Check out the parseSpec procedure in the specs module for a full and reliable reference

action

Specifies what action this test should take.

Default: run

Options:

  • compile - compiles the module and fails the test if compilations fails.
  • run - compiles and runs the module, fails the test if compilation or execution of test code fails.
  • reject - compiles the module and fails the test if compilation succeeds.

There are certain spec keys that imply run, including output and outputsub.

cmd

Specifies the Nim command to use for compiling the test.

There are a number of variables that are replaced in this spec option:

  • $target - the compilation target, e.g. c.
  • $options - the options for the compiler.
  • $file - the filename of the test.
  • $filedir - the directory of the test file.

Example:

discard """
  cmd: "nim $target --nimblePath:./nimbleDir/simplePkgs $options $file"
"""

Categories

Each folder under this directory represents a test category, which can be tested by running koch tests pcat <category> (or cat to avoid parallel testing, which is slower).

The folder dll contains simple DLL tests.

The folder realtimeGC contains a test for validating that the realtime GC can run properly without linking against the nimrtl.dll/so. It includes a C client and platform specific build files for manual compilation.