Files
Nim/tests
PMunch e9ed4dccb6 Quote do now works with result in block (#7343)
* Fix result not being able to use in quote do

This fixes the annoying issue of not be able to use result inside a
quote do block. It works by a simple trick. The quote do mechanic is
based on dynamically creating a template and immediately calling it with
the arguments found within the quote do block. Since this is called in
the scope of the macro the result variable is shadowed. This trick works
by changing all occurences of result (which shouldn't cause any issues
as result isn't used for anything else for the same reason) to another
name and then passing in an IdentNode with result as a named parameter
with that name.

Note that currently this just replaces it with a fixed named variable
"res" which should be changed to a non-colliding, dynamically created
name.

* Fix hard coded parameter "res" to anonymous symbol

This fixes the hard coded parameter "res" to be an anonymous symbol
instead so it won't collide with other parts of the argument list.

* Add test case for result in quote do block

A simple test case based on GitHub issue #7323 on how you can't put
result in a quote do block. This test verifies that it actually works
correctly now.

* Add test for explicit capturing of result

* Rebased against devel
2018-10-31 22:14:29 +01:00
..
2017-07-25 09:28:23 +02:00
2018-10-13 08:39:56 +02:00
2018-10-17 19:46:42 +02:00
2015-03-17 17:50:32 +01:00
2018-10-24 13:10:44 +02:00
2018-02-10 20:55:22 +01:00
2014-01-13 02:10:03 +01:00
2018-02-10 20:55:22 +01:00
2018-05-02 13:34:54 +02:00
2018-10-19 21:04:32 +02:00
2018-10-30 15:30:33 +01:00
2018-09-14 20:10:46 +02:00
2018-09-26 11:32:02 +02:00
2018-07-05 19:14:18 +02:00
2018-08-10 17:27:30 +02:00
2018-04-29 23:26:21 +01:00
2018-01-21 03:04:22 +01:00
2018-09-21 18:59:46 +02:00
2016-08-04 19:36:13 +02:00
2018-08-22 17:34:16 +02:00
2018-10-30 16:41:06 +01:00
2018-09-04 18:25:54 -05:00
2018-02-10 20:55:22 +01:00
2018-08-13 23:16:03 +02:00
2018-05-14 21:38:18 +02:00
2018-06-15 19:46:17 +03:00
2018-10-17 19:46:42 +02:00
2018-08-21 22:14:12 +02:00
2017-11-18 23:03:16 +01:00
2018-09-03 10:02:37 +02:00
2018-10-18 17:00:23 +02:00
2018-08-05 09:59:16 +02:00
2017-07-25 09:28:23 +02:00
2013-03-16 23:53:07 +01:00
2018-10-12 17:27:47 +02: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.