summaryrefslogtreecommitdiff
path: root/tests/README.md
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-03 16:13:35 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-03 16:13:35 +0100
commit46921a8c283718402322d4d09c0bd1d9194278b1 (patch)
treed218e7845c0491570d5535a4515c1c0f956f37b6 /tests/README.md
parent37a7afddfaffd44cb9bc013c9506599267e08983 (diff)
Separate test crate
This removes the not-really-cyclic dependency that confuses rust-analyzer. See also: https://github.com/rust-lang/rust-analyzer/issues/2414
Diffstat (limited to 'tests/README.md')
-rw-r--r--tests/README.md43
1 files changed, 27 insertions, 16 deletions
diff --git a/tests/README.md b/tests/README.md
index 7343d868..baca9148 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -2,6 +2,7 @@
## Directory structure
Top level directory structure:
+- `src`: Testing code.
- `typ`: Input files.
- `res`: Resource files used by tests.
- `ref`: Reference images which the output is compared with to determine whether
@@ -10,24 +11,34 @@ Top level directory structure:
- `pdf`: PDF files produced by tests.
## Running the tests
-Running the integration tests (the tests in this directory).
+Running all tests (including unit tests):
```bash
-cargo test --test typeset
+cargo test --all
+```
+
+Running just the integration tests (the tests in this directory):
+```bash
+cargo test --all --test tests
+```
+
+You may want to [make yourself an alias](#making-an-alias) like:
+```bash
+testit
```
Running all tests whose paths contain the string `page` or `stack`.
```bash
-cargo test --test typeset page stack
+testit page stack
```
Running a test with the exact filename `page.typ`.
```bash
-cargo test --test typeset -- --exact page.typ
+testit --exact page.typ
```
Debug-printing the layout trees for all executed tests.
```bash
-cargo test --test typeset -- --debug empty.typ
+testit --debug empty.typ
```
To make the integration tests go faster they don't generate PDFs by default.
@@ -35,7 +46,7 @@ Pass the `--pdf` flag to generate those. Mind that PDFs are not tested
automatically at the moment, so you should always check the output manually when
making changes.
```bash
-cargo test --test typeset -- --pdf
+testit --pdf
```
## Creating new tests
@@ -50,23 +61,23 @@ oxipng -o max path/to/image.png
oxipng -r -o max tests/ref
```
-## Shorthand for running tests
+## Making an alias
If you want to have a quicker way to run the tests, consider adding a shortcut
to your shell profile so that you can simply write something like:
```bash
-tests --debug empty.typ
+testit empty.typ
+```
+
+### Bash
+Open your Bash configuration by executing `nano ~/.bashrc`.
+```bash
+alias testit="cargo test --all --test tests --"
```
### PowerShell
Open your PowerShell profile by executing `notepad $profile`.
```ps
-function tests {
- cargo test --test typeset -- $args
+function testit {
+ cargo test --all --test tests -- $args
}
```
-
-### Bash
-Open your Bash configuration by executing `nano ~/.bashrc`.
-```bash
-alias tests="cargo test --test typeset --"
-```