2020-09-07 13:48:15 +02:00
|
|
|
# Automated tests
|
|
|
|
|
2021-02-05 16:46:20 +01:00
|
|
|
TLDR: run `v test-all` locally, after making your changes,
|
2021-01-17 15:04:08 +01:00
|
|
|
and before submitting PRs.
|
|
|
|
|
|
|
|
## Notes
|
2020-09-07 13:48:15 +02:00
|
|
|
In the `v` repo there are several different tests. The main types are:
|
|
|
|
|
2021-02-05 16:46:20 +01:00
|
|
|
* `_test.v` tests - check that `test_` functions succeed. These can be
|
2020-09-07 13:48:15 +02:00
|
|
|
run per directory or individually.
|
2021-02-05 16:46:20 +01:00
|
|
|
* `.out` tests - run a `.vv` file and check the output matches the
|
|
|
|
contents of the `.out` file with the same base name. This is
|
2020-09-07 13:48:15 +02:00
|
|
|
particularly useful for checking that errors are printed.
|
|
|
|
|
|
|
|
Tip: use `v -cc tcc` when compiling tests for speed.
|
|
|
|
|
|
|
|
## `vlib/v/tests`
|
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
General runnable tests for different features of the V compiler.
|
2020-09-07 13:48:15 +02:00
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
## Test building of actual V programs (examples, tools, V itself)
|
2020-09-07 13:48:15 +02:00
|
|
|
|
|
|
|
* `v build-tools`
|
2021-01-17 15:04:08 +01:00
|
|
|
* `v build-examples`
|
|
|
|
* `v build-vbinaries`
|
2020-09-07 13:48:15 +02:00
|
|
|
|
|
|
|
## vfmt tests
|
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
In `vlib/v/fmt/` there are::
|
2020-09-07 13:48:15 +02:00
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
* `v vlib/v/fmt/fmt_test.v`
|
2020-09-07 13:48:15 +02:00
|
|
|
|
|
|
|
This checks `.out` tests.
|
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
* `v vlib/v/fmt/fmt_keep_test.v`
|
2020-09-07 13:48:15 +02:00
|
|
|
|
|
|
|
This verifies that `_keep.v` files would be unchanged by `vfmt -w`.
|
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
* `v vlib/v/fmt/fmt_vlib_test.v`
|
2020-09-07 13:48:15 +02:00
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
This checks all source files are formatted and prints a summary.
|
|
|
|
This is not required.
|
2020-09-07 13:48:15 +02:00
|
|
|
|
2021-01-17 15:04:08 +01:00
|
|
|
## Other
|
2020-09-07 13:48:15 +02:00
|
|
|
* `v test-fmt`
|
|
|
|
|
|
|
|
Test all files in the current directory are formatted.
|
|
|
|
|
2021-02-05 16:46:20 +01:00
|
|
|
* `v check-md -hide-warnings .`
|
2021-01-17 15:04:08 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2020-09-07 13:48:15 +02:00
|
|
|
## `.github/workflows/ci.yml`
|
|
|
|
|
|
|
|
This runs various CI tests, e.g.:
|
|
|
|
|
|
|
|
* `v vet vlib/v` - style checker
|
|
|
|
* `v fmt -verify` on certain source files
|
2021-01-17 15:04:08 +01:00
|
|
|
|
|
|
|
## `v test-cleancode`
|
|
|
|
|
|
|
|
Check that most .v files, are invariant of `v fmt` runs.
|
|
|
|
|
2021-01-19 09:41:51 +01:00
|
|
|
## `v test-self`
|
2021-01-17 15:04:08 +01:00
|
|
|
|
|
|
|
Run `vlib` module tests, *including* the compiler tests.
|
|
|
|
|
|
|
|
## `v vlib/v/compiler_errors_test.v`
|
|
|
|
|
|
|
|
This runs tests for:
|
|
|
|
* `checker/tests/*.vv`
|
|
|
|
* `parser/tests/*.vv`
|
|
|
|
|
|
|
|
## `v test-all`
|
|
|
|
|
|
|
|
Test and build *everything*. Usefull to verify *locally*, that the CI will
|
2021-02-05 16:46:20 +01:00
|
|
|
most likely pass. Slowest, but most comprehensive.
|
2021-01-17 15:04:08 +01:00
|
|
|
|
|
|
|
It works, by running these in succession:
|
|
|
|
* `v test-cleancode`
|
2021-01-19 09:41:51 +01:00
|
|
|
* `v test-self`
|
2021-01-17 15:04:08 +01:00
|
|
|
* `v test-fmt`
|
|
|
|
* `v build-tools`
|
|
|
|
* `v build-examples`
|
2021-02-05 16:46:20 +01:00
|
|
|
* `v check-md -hide-warnings .`
|
2021-01-17 15:04:08 +01:00
|
|
|
* `v install nedpals.args`
|