add TESTS.md file to explain different tests (#6318)

pull/6327/head
Nick Treleaven 2020-09-07 12:48:15 +01:00 committed by GitHub
parent 2cb711ee15
commit 497bf226e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 75 additions and 4 deletions

View File

@ -30,6 +30,7 @@ Before submitting a PR, please:
./v -o v cmd/v
./v -o v cmd/v
```
See also `TESTS.md`.
I try to process PRs as soon as possible. They should be handled within 24 hours.

View File

@ -16,8 +16,8 @@ Be careful, if you introduce a breaking change and rebuild V, you will no longer
be able to use V to build itself. So it's a good idea to make a backup copy of a
working compiler executable.
But don't worry, you can always simply run `make`, it will download the C
version of the compiler and rebuild it from scratch.
But don't worry, you can always simply run `make` (or `make.bat`), it will
download the C version of the compiler and rebuild it from scratch.
The main files are:
@ -138,7 +138,7 @@ feature/bugfix* that you make.
### Testing your commits locally:
You can test locally whether your changes have not broken something by
running: `v test-compiler`
running: `v test-compiler`. See `TESTS.md` for more details.
### Publishing your commits to GitHub:

69
TESTS.md 100644
View File

@ -0,0 +1,69 @@
# Automated tests
In the `v` repo there are several different tests. The main types are:
* `_test.v` tests - check that `test_` functions succeed. These can be
run per directory or individually.
* `.out` tests - run a `.vv` file and check the output matches the
contents of the `.out` file 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.
## `v test-compiler`
This builds and tests:
* `vc` repo
* `_test.v` files
* examples
* `v install` a module
Some of these can be invoked separately.
## `vlib/v/compiler_errors_test.v`
This runs tests for:
* `checker/tests/*.vv`
* `parser/tests/*.vv`
## `vlib/v/tests`
General runnable program tests.
## Actual code
* `v build-examples`
* `v build-tools`
## `v test-fixed`
Test `vlib`.
## vfmt tests
In `vlib/v/fmt/` there's:
* `fmt_test.v`
This checks `.out` tests.
* `fmt_keep_test.v`
This verifies that `_keep.v` files would be unchanged by `vfmt -w`.
* `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.
## `.github/workflows/ci.yml`
This runs various CI tests, e.g.:
* `v vet vlib/v` - style checker
* `v fmt -verify` on certain source files

View File

@ -7,7 +7,7 @@ but which are used less frequently by users:
build-examples Test if all examples can be built.
build-tools Test if all tools can be built.
build-vbinaries Test if V can be built with different configuration.
test-fmt Test if all files in the current directory is formatted properly.
test-fmt Test if all files in the current directory are formatted properly.
test-compiler Test if V is working properly by running all tests, including the compiler ones.
NB: this can take a minute or two to run

View File

@ -2,3 +2,4 @@ CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
README.md
TESTS.md