CONTRIBUTING.md: Encourage regression tests (#2089)

* CONTRIBUTING.md: Encourage regression tests

* Add colon before listing pros of regression tests

Co-authored-by: Keith Hall <keith-hall@users.noreply.github.com>
This commit is contained in:
Martin Nordholts 2022-02-26 17:03:54 +01:00 committed by GitHub
parent 14ddda0a8b
commit 1ee49b4d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -46,3 +46,25 @@ If you really think that a particular syntax or theme should be added for all
users, please read the corresponding users, please read the corresponding
[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md) [documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
first. first.
## Regression tests
You are strongly encouraged to add regression tests. Regression tests are great,
not least because they:
* ensure that your contribution will never completely stop working,
* makes code review easier, because it becomes very clear what the code is
supposed to do.
For functional changes, you most likely want to add a test to
[`tests/integration_tests.rs`](https://github.com/sharkdp/bat/blob/master/tests/integration_tests.rs).
Look at existing tests to know how to write a new test. In short, you will
invoke the `bat` binary with a certain set of arguments, and then assert on
stdout/stderr.
To learn how to write regression tests for theme and syntax changes, read the
[Syntax
tests](https://github.com/sharkdp/bat/blob/master/doc/assets.md#syntax-tests)
section in `assets.md`.