Skip to content

Commit 0e07af1

Browse files
authored
Add init_code to readme (#18)
1 parent e76dd12 commit 0e07af1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ runtests(ARGS)
3535

3636
### Filtering
3737

38-
`runtests` takes a second argument that acts as a filter function
38+
`runtests` takes a keyword argument that acts as a filter function
3939

4040
```julia
4141
function testfilter(test)
@@ -45,9 +45,22 @@ function testfilter(test)
4545
return true
4646
end
4747

48-
runtests(ARGS, testfilter)
48+
runtests(ARGS; testfilter)
4949
```
5050

51+
### Provide defaults
52+
53+
`runtests` takes a keyword argument that one can use to provide default definitions to be loaded before each testfile.
54+
As an example one could always load `Test` and the package under test.
55+
56+
```julia
57+
const init_code = quote
58+
using Test
59+
using MyPackage
60+
end
61+
62+
runtests(ARGS; init_code)
63+
```
5164

5265
## Inspiration
5366
Based on [@maleadt](https://github.com/maleadt) test infrastructure for [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl).

0 commit comments

Comments
 (0)