unison/unison-src/transcripts/test-command.md

58 lines
900 B
Markdown
Raw Permalink Normal View History

2022-07-11 18:23:31 +03:00
Merge builtins so we get enough names for the testing stuff.
```ucm:hide
scratch/main> builtins.merge
2022-07-11 18:23:31 +03:00
```
The `test` command should run all of the tests in the current directory.
```unison
test1 : [Result]
test1 = [Ok "test1"]
2024-05-14 23:54:53 +03:00
foo.test2 : [Result]
foo.test2 = [Ok "test2"]
2022-07-11 18:23:31 +03:00
```
2023-12-13 23:35:04 +03:00
```ucm:hide
scratch/main> add
2023-12-13 23:35:04 +03:00
```
2022-07-11 18:23:31 +03:00
```ucm
scratch/main> test
2022-07-11 18:23:31 +03:00
```
2023-12-13 23:36:34 +03:00
Tests should be cached if unchanged.
```ucm
scratch/main> test
2023-12-13 23:36:34 +03:00
```
2022-07-11 18:23:31 +03:00
`test` won't descend into the `lib` namespace, but `test.all` will.
```unison
2024-06-26 22:00:40 +03:00
lib.dep.testInLib : [Result]
lib.dep.testInLib = [Ok "testInLib"]
2022-07-11 18:23:31 +03:00
```
```ucm:hide
2024-06-26 22:00:40 +03:00
scratch/main> add
2022-07-11 18:23:31 +03:00
```
```ucm
scratch/main> test
scratch/main> test.all
2022-07-11 18:23:31 +03:00
```
2024-06-26 22:00:40 +03:00
`test` WILL run tests within `lib` if specified explicitly.
```ucm
2024-06-26 22:00:40 +03:00
scratch/main> test lib.dep
```
2024-05-14 23:54:53 +03:00
`test` can be given a relative path, in which case it will only run tests found somewhere in that namespace.
```ucm
scratch/main> test foo
2024-05-14 23:54:53 +03:00
```