Nim/tests
Timothee Cour f6ba4e81b0 maybe: allows optional chaining of field access and indexing when LHS i snil (#13023)
* maybe: allows optional chaining
* fix tools/kochdocs.nim
* improve semantics to distinguish valid from invalid values
* for now, wrapnil, isValid, unwrap are not exported
2020-01-18 12:24:56 +01:00
..
actiontable
alias
align fixes #13122 (#13126) 2020-01-13 14:11:51 +01:00
ambsym
arc ARC works for async on Windows (#13179) 2020-01-17 11:14:17 +01:00
arithm ungeneric unsigned ops (#12230) 2019-10-11 08:38:08 +02:00
array guards.nim:sameTree(): handle uint literals correctly (#12483) [backport] 2019-10-22 18:18:33 +02:00
assert --exception:goto switch for deterministic exception handling (#12977) 2020-01-01 10:01:49 +01:00
assign fix rtti sizeof for varargs in global scope (#13125) [backport] 2020-01-13 10:17:21 +01:00
astoverload
astspec Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
async fix #12919 tasyncclosestall flaky: Address already in use (#12934) 2019-12-19 18:50:39 +01:00
bind
borrow
casestmt case coverage error message for char (#12948) 2019-12-22 10:10:46 +01:00
ccgbugs style fix: change 'JS' to 'js' to make it consistent (#13168) 2020-01-16 14:14:03 +01:00
clearmsg
closure introduce capture macro (#12712) 2019-12-10 13:16:37 +01:00
cnstseq
collections fixes #11764, faster hashing of (u)int (#12407) 2019-10-15 16:31:07 +02:00
compilepragma
compiler Fixes #12536 (#12568) [backport] 2019-11-02 08:21:49 +01:00
compilerapi make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts (#13170) 2020-01-17 10:34:31 +01:00
compilerfeatures
compiles delete list comprehension (#12392) 2019-11-22 19:57:43 +01:00
concat
concepts fixes a test case 2019-12-24 17:33:27 +01:00
constr
constraints
constructors
controlflow
converter Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
coroutines
cpp test suite: rename tests containing 'fail' for easier search in logs 2019-11-26 16:04:28 +01:00
defaultprocparam
deprecated
deps [backport] Fix spelling typos (#12755) 2019-11-28 08:30:55 +01:00
destructor make sink operator optional (#13068) 2020-01-17 11:44:06 +00:00
dir with space
discard
distinct
dll #12103 - CI for FreeBSD (#12179) 2019-11-29 21:00:54 +01:00
effects
enum fix enumtostr crash for enum-range (#13035) 2020-01-05 09:18:14 +01:00
errmsgs Assigning template to var/let/const gives a proper error (#12851) 2019-12-09 08:19:40 +00:00
exception --exception:goto switch for deterministic exception handling (#12977) 2020-01-01 10:01:49 +01:00
exprs
fields
flags
float remove unused imports from tests 2019-11-06 14:35:45 +01:00
fragmentation
friends
gc fixes #12899 (#12921) 2019-12-18 07:54:20 +01:00
generics [backport] fix #12528, fix #12525: incorrect generic type resolution for default values (#12538) 2019-10-28 16:56:38 +01:00
gensym fixes yet another gensym regression (#12145) 2019-09-06 00:45:00 +02:00
global
ic Incremental compilation (IC): Improvements (#11881) 2019-08-08 08:41:05 +02:00
implicit
import_in_config
init
iter fixes #12945 (#12959) 2019-12-24 20:34:14 +01:00
js style fix: change 'JS' to 'js' to make it consistent (#13168) 2020-01-16 14:14:03 +01:00
lent fixes #12224 (#12225) 2019-09-21 06:45:27 +02:00
let
lexer
lookups
macros fix #12740 (#12774) 2019-12-04 07:33:01 +00:00
magics
manyloc remove deprecated procs (#12535) 2019-11-05 11:05:46 +01:00
metatype fixes #13095 (#13181) 2020-01-17 09:17:18 +01:00
method clean up deprecated stuff and unused imports in tests (#13059) 2020-01-07 09:49:08 +01:00
misc fix tsizeof3 for aarch64 (#13169) 2020-01-16 14:21:12 +01:00
modules fixes #12420 [backport] (#12456) 2019-10-18 22:13:24 +02:00
namedparams fixes #12196 2019-09-16 12:12:44 +02:00
newconfig
nimble Fixes #12767 (#12768) 2019-11-29 10:18:44 +01:00
niminaction #12103 - CI for FreeBSD (#12179) 2019-11-29 21:00:54 +01:00
notnil Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
objects Fixed objects being erroneously zeroed out before object construction (#12814) [backport] 2019-12-05 17:31:51 +01:00
objvariant Better case coverage error message for alias and range enum (#12913) 2019-12-18 10:29:01 +01:00
openarray clean up deprecated stuff and unused imports in tests (#13059) 2020-01-07 09:49:08 +01:00
osproc
overflw
overload
package_level_objects
parallel remove deprecated procs (#12535) 2019-11-05 11:05:46 +01:00
parser
pragmas fixes #5050; fixes #11826 (#12606) [backport] 2019-11-07 14:47:26 +01:00
proc allow typed/untyped in magic procs (#12911) 2019-12-17 11:07:32 +01:00
procvar
range Merge branch 'devel' into uint-range-checks 2019-09-02 22:03:10 +02:00
rational
realtimeGC
rodfiles
seq
sets
showoff remove deprecated procs (#12535) 2019-11-05 11:05:46 +01:00
specialops
statictypes remove deprecated procs (#12535) 2019-11-05 11:05:46 +01:00
stdlib maybe: allows optional chaining of field access and indexing when LHS i snil (#13023) 2020-01-18 12:24:56 +01:00
system lenVarargs: number of varargs elements (#12907) 2019-12-23 09:42:32 +01:00
template Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
testament test suite: rename tests containing 'fail' for easier search in logs 2019-11-26 16:04:28 +01:00
testdata
threads
tools fixes #12885 [backport] (#12895) 2019-12-13 19:20:29 +01:00
trmacros
tuples fix several typos in documentation and comments (#12553) 2019-10-30 09:08:45 +01:00
typerel
types
untestable fix #12426 (#12462) 2019-10-20 11:52:50 +02:00
usingstmt
valgrind attempt to add valgrind support to the CIs and testament (#12646) 2019-11-18 09:10:48 +01:00
varres
varstmt
vm VM FFI: write(stderr, msg) and fprintf(cstderr, msg) now work at CT (#13083) 2020-01-12 13:44:43 +01:00
ast_pattern_matching.nim
config.nims
dummy.txt
js.html
js.nim
mmaptest.nim Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
readme.md Fix reference to parseSpec proc in readme (#12359) 2019-10-04 19:30:58 +02:00
rectest.nim
stckovfl.nim
test_nimscript.nims

This directory contains the test cases.

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

Note: Tests are only compiled by default. In order to get the tester to execute the compiled binary, you need to specify a spec with an action key (see below for details).

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: compile

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 cat <category>.

The folder rodfiles contains special tests that test incremental compilation via symbol files.

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.