TLDR: run v test-all locally, after making your changes,
and before submitting PRs.
In the v repo there are several different tests. The main types are:
_test.vtests - check thattest_functions succeed. These can be run per directory or individually..outtests - run a.vvfile and check the output matches the contents of the.outfile with the same base name. This is particularly useful for checking that errors are printed.
Tip: use v -cc tcc when compiling tests for speed.
General runnable tests for different features of the V compiler.
vlib/v/tests/inout/compiler_test.v
Test output of running a V program matches an expected .out file. Check the source for how to test panics.
vlib/v/gen/c/coutput_test.v
This tests whether the generated C source code matches all expectations, specified in *.c.must_have files, in the folder vlib/v/gen/c/testdata/ .
Each .c.must_have file has to have a corresponding .vv file.
Each .c.must_have file, consists of multiple lines. Each of these
lines, should be present at least once in the output, when the .vv
file is compiled with -o - .
vlib/v/tests/run_project_folders_test.vTests whether whole project folders can be compiled, and run. NB: Each project in these folders, should finish with exit code 0, and it should outputOKas its last stdout line.
v build-toolsv build-examplesv build-vbinaries
In vlib/v/fmt/ there are::
v vlib/v/fmt/fmt_test.v
This checks .out tests.
v vlib/v/fmt/fmt_keep_test.v
This verifies that _keep.v files would be unchanged by vfmt -w.
v vlib/v/fmt/fmt_vlib_test.v
This checks all source files are formatted and prints a summary. This is not required.
v test-fmt
Test all files in the current directory are formatted.
v check-md -hide-warnings .
Ensure that all .md files in the project are formatted properly, and that the V code block examples in them can be compiled/formatted too.
This runs various CI tests, e.g.:
v vet vlib/v- style checkerv fmt -verifyon certain source files
Check that most .v files, are invariant of v fmt runs.
Run vlib module tests, including the compiler tests.
This runs tests for:
vlib/v/checker/tests/*.vvvlib/v/parser/tests/*.vv
run/compile with specific options:
vlib/v/checker/tests/globals_run/ - -enable-globals run;
results stored in .run.out files, matching the .vv ones.
Test and build everything. Usefull to verify locally, that the CI will most likely pass. Slowest, but most comprehensive.
It works, by running these in succession:
v test-cleancodev test-selfv test-fmtv build-toolsv build-examplesv check-md -hide-warnings .v install nedpals.args