v/cmd/v/help/test.txt

19 lines
792 B
Plaintext
Raw Normal View History

2020-03-13 20:52:49 +01:00
Usage:
v [-stats] test FILE|DIRECTORY[...]
Runs test functions in the given FILEs and DIRECTORYs
2020-03-13 20:52:49 +01:00
If '-stats' is given, more statistics about the tests are printed along
with a report of passes/failures
2020-03-13 20:52:49 +01:00
NB 1: very frequently, when you work on a module you can cd into its folder,
and then you can perform:
v test .
... to run all the module's '_test.v' files.
2020-03-13 20:52:49 +01:00
NB 2: V builtin testing requires you to name your files with a _test.v
suffix, and to name your test functions with test_ prefix. Each 'test_'
function in a '_test.v' file will be called automatically by the test
framework. You can use `assert condition` inside each 'test_' function.
2020-03-13 20:52:49 +01:00
If the asserted condition fails, then v will record that and produce a
more detailed error message about where the failure was.