Skip to content

Commit 9073398

Browse files
committed
update README
1 parent 1911183 commit 9073398

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,30 @@
44

55
This package allows:
66

7-
1. defining tests in source files, whose execution is deferred and triggered on demand.
7+
1. Defining tests in source files, whose execution is deferred and triggered on demand.
88

99
This is useful when one likes to have definitions of methods and
1010
corresponding tests close to each other. This is also useful for code which
1111
is not (yet) organized as a package, and where one doesn't want to maintain a
1212
separate set of files for tests.
1313

14-
2. filtering run testsets with a `Regex`, which is matched against the
14+
2. Filtering run testsets with a `Regex`, which is matched against the
1515
descriptions of testsets.
1616

1717
This is useful for running only part of the test suite of a package. For
1818
example, if you made a change related to addition, and included "addition" in
19-
the description of the corresponding tetstsets, you can easily run only these
19+
the description of the corresponding testsets, you can easily run only these
2020
tests.
2121

2222
Note that a [pull request](https://github.com/JuliaLang/julia/pull/33672)
2323
exists in the Julia repository to implement regex-filtering for
2424
`Test.@testset`.
2525

2626
The exported `ReTest.@testset` macro can be used as a direct replacement for
27-
`Test.@testset`, and `runtests()` has to be called for the tests to be executed.
28-
See the docstrings (reproduced below) for more details. Moreover, `ReTest`
29-
re-exports (almost) all exported symbols from `Test`, so there should not be any
30-
need to import `Test` together with `ReTest`.
27+
`Test.@testset` (with limitations, see below), and `runtests()` has to be called
28+
for the tests to be executed. See the docstrings (reproduced below) for more
29+
details. Moreover, `ReTest` re-exports (almost) all exported symbols from
30+
`Test`, so there should not be any need to import `Test` together with `ReTest`.
3131

3232
### `runtests` docstring
3333

@@ -58,7 +58,9 @@ matched by `pattern`) and its subject matches `pattern`.
5858

5959
If the passed `pattern` is a string, then it is wrapped in a `Regex` prefixed with
6060
`".*"`, and must match literally the subjects.
61-
This means for example that `"a|b"` will match a subject like `"a|b"` but not like `"a"`.
61+
This means for example that `"a|b"` will match a subject like `"a|b"` but not like `"a"`
62+
(only in Julia versions >= 1.3; in older versions, the regex is simply created as
63+
`Regex(".*" * pattern)`).
6264
The `".*"` prefix is intended to allow matching subjects of nested testsets,
6365
e.g. in the example above, `r".*b"` partially matches the subject `"/a"` and
6466
matches the subject `"/a/b"` (so the corresponding nested testset is run),
@@ -83,8 +85,8 @@ module in which it was written (e.g. `m`, when specified).
8385
j=J` is not supported). Both problems should be fixable.
8486

8587
Related to the previous point: in future versions, nested testsets-for might
86-
have their "iterator" (giving the values their loop variables) `eval`ed at the
87-
module's toplevel (for efficiency).
88+
have their "iterator" (giving the values to their loop variables) `eval`ed at
89+
the module's toplevel (for efficiency).
8890

8991
* Testsets can not be "custom testsets" (cf. `Test` documentation; this should
9092
be easy to support).
@@ -122,7 +124,7 @@ filter them out (if a filtering pattern is given to `runtests`) "statically",
122124
i.e. by introspection, we can figure out whether they should be run before
123125
having to `eval` the corresponding code. This is a big win, in particular for
124126
`testsets-for`, which are expensive to compile. This allows `ReTest` to
125-
compete with the good-old manual way of copy-pasting the wanted `@testset` into
127+
compete with the good ol' manual way of copy-pasting the wanted `@testset` into
126128
the REPL (without this trick, all the testsets would have to be `eval`ed, even
127129
when they don't run any code, and this can take some time for large test
128130
codebases.
@@ -176,5 +178,5 @@ Note also that partial matching often gives a false positive, e.g. running
176178
`runtests(M, "d")` will currently instantiate `@testset "a"` because it might
177179
contain a sub-testset `"d"`, so `@test true` above will be run, even if
178180
eventually no testset matches `"d"`. So it's recommended to put expensive tests
179-
withing "final" testsets (those which don't have nested testsets), such that
181+
within "final" testsets (those which don't have nested testsets), such that
180182
"full matching" is used instead of partial matching.

0 commit comments

Comments
 (0)