Nim/tests
alaviss 7ef268274f Haiku support for Nim (#8542)
* posix_other: Haiku now has spawn.h

This is added per https://dev.haiku-os.org/ticket/13446

* posix_other: Add Haiku specific Dirent members

* cpuinfo: Add an implementation for Haiku

* distros: Add basic Haiku support

* encodings: update Haiku support

* fenv, math: Haiku now provides libm

* times: Add Haiku struct members

* ansi_c, osalloc: Add Haiku constants

* threads: Add Haiku support

* testament: Haiku uses LIBRARY_PATH

* nim.cfg: Update Haiku support

libnetwork should only be linked if network functions are used

* threads: Haiku does not support -pthread switch

* tworkingdir: Haiku's env is in /bin

* posix_other: add SIGKILLTHR for Haiku

* sockets: link with libnetwork on Haiku

* coro: correct ucontext.h location

http://pubs.opengroup.org/onlinepubs/009696699/basedefs/ucontext.h.html

* coro: ucontext backend is not available on Haiku

Haiku doesn't provide the <ucontext.h> header, as it was removed from POSIX

* coro: fix setjmp backend

The compiler does not allow statements after a noreturn function

* nativesockets: Haiku doesn't support AI_V4MAPPED

* system: hostOS can contains "haiku"

* os: add support for Haiku's packagefs

packagefs is read-only, but there are writable holes to the underlying
file system as well

* os: update constant for Haiku
2018-08-14 09:35:07 +02:00
..
actiontable tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
alias Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
ambsym tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
arithm fixes #6255, add system.ashr arithmetic right shift (#8547) 2018-08-07 18:41:30 +02:00
array fixes #7906, array and openarray arg vs. ptr/ref generic (#7909) 2018-06-04 17:43:15 +02:00
assert make tests green again 2018-07-05 15:51:04 +02:00
assign make tests green again 2018-07-05 15:51:04 +02:00
astoverload new tester; all tests categorized 2014-01-13 02:10:03 +01:00
async disable tioselectors test for OSX 2018-08-06 19:44:15 +02:00
benchmarks tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
bind make tests green again 2018-07-05 19:14:18 +02:00
borrow tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
caas Rename PNimrodNode to NimNode 2015-03-17 17:50:32 +01:00
casestmt Resolve converter call to constants in case arms (#8336) 2018-07-16 16:19:31 +02:00
ccgbugs Fixes 8616 (#8617) 2018-08-12 20:43:30 +02:00
clearmsg make more tests green 2018-02-10 20:55:22 +01:00
closure Mysterious fix for #8550 (#8561) 2018-08-12 20:41:48 +02:00
cnstseq tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
collections Updated tests for CritBitTree $ 2018-06-07 18:49:59 +03:00
compilerapi compiler API: final cleanups; improve security by diabling 'gorge' and friends 2018-05-29 09:07:24 +02:00
compiles make tests green again 2018-05-02 13:34:54 +02:00
concat new tester; all tests categorized 2014-01-13 02:10:03 +01:00
concepts fixes #6255, add system.ashr arithmetic right shift (#8547) 2018-08-07 18:41:30 +02:00
constr the parser finally parses 'echo {1,2}' as it should 2017-09-30 21:35:30 +02:00
constraints make more tests green 2018-02-10 20:55:22 +01:00
constructors make tests green again 2018-05-02 13:34:54 +02:00
controlflow make tests green again 2018-05-14 21:38:18 +02:00
converter Converters to take into account constraints. Fixes #7520 (#8593) 2018-08-13 15:02:20 +02:00
coroutines attempt to make travis OSX tests green and mandatory 2017-03-29 10:14:03 +02:00
cpp Generate dynlib strings as a single rope (#8247) 2018-07-08 22:07:45 +02:00
defaultprocparam new tester; all tests categorized 2014-01-13 02:10:03 +01:00
deprecated fixes --gc:none regression; made some tests green 2015-03-10 12:32:47 +01:00
destructor turn destructors into finalizers 2018-07-05 11:31:27 +02:00
dir with space tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
discard make tests green again 2018-07-05 15:51:04 +02:00
distinct make tests green 2018-05-02 13:34:54 +02:00
dll tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
effects make tests green again 2018-07-05 19:14:18 +02:00
enum remove dead code elimination option (#7669) 2018-04-23 11:02:38 +02:00
errmsgs fixes #8434 (incomplete info in errmsg about 'required type') (#8441) 2018-07-30 10:41:59 +02:00
exception make tests green again 2018-07-05 15:51:04 +02:00
exprs make tests green again 2018-07-05 19:14:18 +02:00
fields make tests green again 2018-07-05 15:51:04 +02:00
flags Fixes #802, #803 and #3775 - genscript issues (#7677) 2018-04-25 10:52:32 +02:00
float update test 2018-04-29 23:26:21 +01:00
fragmentation fixes #8509 disable 4GB allocating test on windows that crashed appveyor (#8510) 2018-08-02 13:33:46 +02:00
friends tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
gc fixes 7833 (#8533) 2018-08-05 11:42:38 +02:00
generics Tests for v1 closed generics/static issues (#8572) 2018-08-08 17:49:33 +02:00
gensym equality check on NimSym has now support in the VM; refs #6139 2017-09-03 01:15:40 +02:00
global Make static blocks introduce their own scope 2018-06-24 18:27:40 +02:00
implicit unsigned array indexes work better; minor cleanups 2015-02-10 20:19:46 +01:00
import_in_config fixes a regression that caused --import in a config file to break things 2016-08-29 11:33:41 +02:00
init Extend init variable tracking to tuple assignments (#8321) 2018-07-17 17:50:05 +02:00
iter Access implicit result trough envP in closures (#8471) 2018-07-30 08:34:15 +02:00
js New implementations of times.parse & times.format (#8094) 2018-07-09 20:04:25 +02:00
lent basic 'lent T' test works 2018-01-21 03:04:22 +01:00
let make more tests green 2018-02-10 20:55:22 +01:00
lexer make tests green again 2018-07-05 15:51:04 +02:00
lookups fixes #4353 2016-08-04 19:36:13 +02:00
macros fixes #5617, 'copyLineInfo' addition (#8523) 2018-08-05 23:38:21 +02:00
magics the parser finally parses 'echo {1,2}' as it should 2017-09-30 21:35:30 +02:00
manyloc make tests green again 2018-07-05 15:51:04 +02:00
metatype Tests for v1 closed generics/static issues (#8572) 2018-08-08 17:49:33 +02:00
method make tests green again 2018-07-05 15:51:04 +02:00
misc Add sizeof for arrays of integral types (#8445) 2018-07-30 11:00:06 +02:00
modules implement the export/except statement 2018-05-07 09:37:49 +02:00
namedparams make more tests green 2018-02-10 20:55:22 +01:00
newconfig Add a few useful os calls to nimscript (#7442) 2018-04-10 18:50:23 +02:00
nimble Implement .nimble-link files in the compiler and add tests for them. 2017-09-02 15:28:25 +01:00
niminaction Adds smaller code samples from Chapters 1-3 to the tester. 2018-06-17 00:12:51 +01:00
notnil make tests green again 2018-05-02 13:34:54 +02:00
objects make tests green again 2018-07-05 19:14:18 +02:00
objvariant make tests green again 2018-05-14 21:38:18 +02:00
openarray fixed #2240 and #3586 2016-01-05 07:52:56 +07:00
osproc Haiku support for Nim (#8542) 2018-08-14 09:35:07 +02:00
overflw Added more tests to toverflw 2018-06-15 19:46:17 +03:00
overload make tests green again 2018-07-05 19:14:18 +02:00
package_level_objects new feature: package level objects 2017-10-29 07:54:39 +01:00
parallel .experimental can now be used to enable specific features 2018-04-24 09:34:29 +02:00
parser Implement the is operator for the new static and typedesc type classes 2018-06-16 16:46:32 +03:00
pragmas fixes #8371, macros.hasCustomPragma doesn't crash anymore (#8378) 2018-07-20 19:48:12 +02:00
proc make tests green again 2018-05-02 13:34:54 +02:00
procvar tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
range make tests green again 2018-05-02 13:34:54 +02:00
rational make tests green again 2017-11-18 23:03:16 +01:00
realtimeGC Fix longgc category tests (#7095) 2018-01-22 15:08:27 +01:00
rodfiles remove dead code elimination option (#7669) 2018-04-23 11:02:38 +02:00
seq fixes #4973 2017-02-01 12:09:24 +01:00
sets fixes #8425 2018-08-04 20:10:03 +02:00
showoff Improved collection-to-string behavior (#6825) 2017-12-14 14:02:13 +01:00
specialops dotops: add a simple object delegation test 2017-12-01 02:05:48 +01:00
statictypes Fix crash with static and anonymous procs (#8171) 2018-07-02 00:49:03 +02:00
stdlib Fixed 7478: splitLines keepEol option (#8621) 2018-08-13 11:42:50 +02:00
system fixed #7894 (#8496) 2018-08-01 10:57:35 +02:00
template make tests green again 2018-07-05 19:14:18 +02:00
testament Haiku support for Nim (#8542) 2018-08-14 09:35:07 +02:00
testdata Fix for #5134 (parseJson(string) should fail on leftover data) (#5203) 2017-01-11 06:50:18 +01:00
threads fixes channels for --gc:regions 2018-05-25 16:21:33 +02:00
trmacros make tests green 2018-05-05 21:45:07 +02:00
tuples rename SomeReal to SomeFloat (#7617) 2018-04-15 19:59:11 +02:00
typerel Fix comparison of tyGenericBody in typerel (#8045) 2018-07-07 20:49:06 +02:00
types Reject ptr/ref void types (#8127) 2018-06-27 21:41:40 +02:00
untestable asyncdispatch: remove outdated documentation about its limitations 2018-07-30 12:20:57 +02:00
usingstmt Remove expr/stmt (#5857) 2017-07-25 09:28:23 +02:00
varres fixes #5113 2018-04-21 23:58:24 +02:00
varstmt tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
vm Fix ref bug in vmgen (#8424) 2018-07-30 22:28:24 +02:00
benchmark.nim tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
js.html
js.nim tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
mmaptest.nim tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
readme.md Add readme to tests. Add fileDir option to testament & create nimble test. 2017-09-02 15:03:39 +01:00
rectest.nim tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
stckovfl.nim tests: Trim .nim files trailing whitespace 2015-09-04 23:04:32 +02:00
test_nimscript.nims bugfix: make 'macros' module available for nimscript 2017-11-14 23:26:46 +01:00

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.