Files
Nim/tests
c-blake 551d7b7dc1 Add ability for users to elide ':' or '=' when CLI authors pass a (#7297)
* Add ability for users to elide ':' or '=' when CLI authors pass a
non-empty partial symbol table.  Behavior should be identical to the
old behavior if empty partial symbol tables are passed.  "Partialness"
of the symbol table refers to the fact that one need only specify
option keys that are toggles/booleans/do not take arguments, hence
the "NoArg" suffixes in shortNoArg and longNoArg.

commandLineParams() returns seq[TaintedString], so use that consistently
in getopt() and initOptParser(seq[TaintedString]) dropping the taint at
the quoting stage just as with the paramStr() logic.

Fix capitalization inconsistency of cmdLongOption.

Export OptParser.cmd and OptParser.pos so that, at least *in principle*,
users of this API can handle "--" option processing termination or some
"git-like" sub-command stop word with a separate option sub-syntax.
{ Eg., ``case p.key of "": echo "trailing non-option args: ", p.cmd[p.pos..^1]``
or ``case p.kind of cmdArgument: if p.key == "mysubcmd": ...``. }  Really,
searching for the last delimiter before p.pos is probably needed to frame
the trailing text..Not the nicest API, but still possible with effort.

* Make requested changes from string to seq[char]
(see https://github.com/nim-lang/Nim/pull/7297)

* Document new behavior and elaborate on some special cases.

* NoArg => NoVal to be less ambiguous/more clear.

* Add more documentation and an example snippet.

* Tweak language. Clarify still using ':'/'=' is ok.

* Add a test case for new NoVal behavior.
2018-03-08 08:12:34 +01:00
..
2017-07-25 09:28:23 +02:00
2017-07-25 09:28:23 +02:00
2018-02-10 20:55:22 +01:00
2015-03-17 17:50:32 +01:00
2018-02-11 13:55:56 +01:00
2018-02-10 20:55:22 +01:00
2018-02-10 20:55:22 +01:00
2017-07-25 09:28:23 +02:00
2014-01-13 02:10:03 +01:00
2018-02-10 20:55:22 +01:00
2017-08-14 17:43:39 +02:00
2016-08-02 14:53:21 +02:00
2018-03-02 12:14:41 +01:00
2017-01-31 23:05:36 +01:00
2018-02-10 20:55:22 +01:00
2018-02-11 14:52:26 +01:00
2018-02-28 10:13:55 +01:00
2017-12-27 21:26:37 +01:00
2018-01-18 09:04:32 +01:00
2018-02-23 11:42:19 +01:00
2018-02-25 17:28:47 +01:00
2018-03-05 10:28:17 +02:00
2018-01-21 03:04:22 +01:00
2018-02-10 20:55:22 +01:00
2017-11-05 13:02:46 +01:00
2016-08-04 19:36:13 +02:00
2018-02-03 07:57:47 +01:00
2018-02-10 20:55:22 +01:00
2018-02-10 20:55:22 +01:00
2017-09-28 21:52:23 +02:00
2018-02-10 20:55:22 +01:00
2018-03-05 19:06:47 +01:00
2017-11-23 03:12:09 +01:00
2018-02-10 20:55:22 +01:00
2016-01-05 07:52:56 +07:00
2018-03-05 13:38:32 +01:00
2017-11-19 20:09:38 +01:00
2017-11-01 18:13:27 +03:00
2017-11-18 23:03:16 +01:00
2016-08-27 13:26:16 +02:00
2017-02-01 12:09:24 +01:00
2017-06-20 11:29:42 +02:00
2018-01-31 16:38:37 +01:00
2017-07-25 09:28:23 +02:00
2018-02-26 10:51:56 +01:00
2017-07-25 09:28:23 +02:00
2017-12-15 13:24:47 +01:00
2017-07-25 09:28:23 +02:00
2017-12-30 10:30:40 +01:00
2013-03-16 23:53:07 +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.