Skip to content

Commit b0dfc71

Browse files
committed
rename package: InlineTest -> ReTest
1 parent 2309697 commit b0dfc71

File tree

6 files changed

+34
-34
lines changed

6 files changed

+34
-34
lines changed

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The InlineTest.jl package is licensed under the MIT "Expat" License:
1+
The ReTest.jl package is licensed under the MIT "Expat" License:
22

33
> Copyright (c) 2020: Rafael Fourquet.
44
>

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name = "InlineTest"
2-
uuid = "bd334432-b1e7-49c7-a2dc-dd9149e4ebd6"
1+
name = "ReTest"
2+
uuid = "e0db7c4e-2690-44b9-bad6-7687da720f89"
33
authors = ["Rafael Fourquet <[email protected]>"]
44
version = "0.1.0"
55

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# InlineTest
1+
# ReTest
22

33
This package allows:
44

@@ -21,11 +21,11 @@ This package allows:
2121
exists in the Julia repository to implement regex-filtering for
2222
`Test.@testset`.
2323

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

3030
### `runtests` docstring
3131

@@ -68,7 +68,7 @@ module in which it was written (e.g. `m`, when specified).
6868

6969
### Caveats
7070

71-
`InlineTest.@testset` comes with a couple of caveats/limitations:
71+
`ReTest.@testset` comes with a couple of caveats/limitations:
7272

7373
* Toplevel testsets (which are not nested within other testsets), when run, are
7474
`eval`ed at the toplevel of their parent module, which means that they can't
@@ -87,16 +87,16 @@ module in which it was written (e.g. `m`, when specified).
8787
* Testsets can not be "custom testsets" (cf. `Test` documentation; this should
8888
be easy to support).
8989

90-
* Nested testsets can't be "qualified" (i.e. written as `InlineTest.@testset`).
90+
* Nested testsets can't be "qualified" (i.e. written as `ReTest.@testset`).
9191

9292
* Regex filtering logic might improve in future versions, which means that with
9393
the same regex, less tests might be run (or more!). See `runtests`'s docstring
9494
to know what testsets are guaranteed to run.
9595

96-
### Switching from `Test` to `InlineTest`
96+
### Switching from `Test` to `ReTest`
9797

9898
When used in a package `MyPackage`, the test code can be organized as follows:
99-
1. replace `using Test` by `using InlineTest` in the "runtests.jl" file
99+
1. replace `using Test` by `using ReTest` in the "runtests.jl" file
100100
2. wrap the whole content of "runtests.jl" within a module named `MyPackageTests`
101101
3. rename "runtests.jl" to "tests.jl"
102102
4. create "runtests.jl" with the following content:
@@ -105,7 +105,7 @@ When used in a package `MyPackage`, the test code can be organized as follows:
105105
This means that running "runtests.jl" will have the same net effect as before.
106106
The "tests.jl" file can now be `include`d in your REPL session (`include("tests.jl")`),
107107
and you can run all or some of its tests
108-
(e.g. `using InlineTest; runtests(MyPackageTests, "addition")`).
108+
(e.g. `using ReTest; runtests(MyPackageTests, "addition")`).
109109
Wrapping the tests in `MyPackageTests` allows to not pollute `Main`, it keeps the tests
110110
of different packages separated, but more importantly, you can modify "tests.jl" and
111111
re-include it to have the corresponding tests updated (otherwise, without
@@ -114,12 +114,12 @@ without removing the old ones).
114114

115115
### Toplevel testsets
116116

117-
In `InlineTest`, toplevel testsets are special, as already mentioned. The fact
117+
In `ReTest`, toplevel testsets are special, as already mentioned. The fact
118118
that they are `eval`ed at the module's toplevel also means that we can actually
119119
filter them out (if a filtering pattern is given to `runtests`) "statically",
120120
i.e. by introspection, we can figure out whether they should be run before
121121
having to `eval` the corresponding code. This is a big win, in particular for
122-
`testsets-for`, which are expensive to compile. This allows `InlineTest` to
122+
`testsets-for`, which are expensive to compile. This allows `ReTest` to
123123
compete with the good-old manual way of copy-pasting the wanted `@testset` into
124124
the REPL (without this trick, all the testsets would have to be `eval`ed, even
125125
when they don't run any code, and this can take some time for large test

src/InlineTest.jl renamed to src/ReTest.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module InlineTest
1+
module ReTest
22

33
export runtests, @testset
44

@@ -36,7 +36,7 @@ struct TestsetExpr
3636
end
3737

3838
function tests(m::Module)
39-
inline_test::Symbol = m (InlineTest, InlineTest.InlineTestTest) ? :__INLINE_TEST__ : INLINE_TEST[]
39+
inline_test::Symbol = m (ReTest, ReTest.ReTestTest) ? :__INLINE_TEST__ : INLINE_TEST[]
4040
if !isdefined(m, inline_test)
4141
@eval m $inline_test = []
4242
push!(TESTED_MODULES, m)
@@ -57,7 +57,7 @@ function replacetestset(x::Expr)
5757
final = !any(last, body)
5858
(Expr(:let,
5959
:($(Testset.FINAL[]) = $final),
60-
Expr(:macrocall, Expr(:., :InlineTest, QuoteNode(Symbol("@testsetr"))),
60+
Expr(:macrocall, Expr(:., :ReTest, QuoteNode(Symbol("@testsetr"))),
6161
map(first, body)...)),
6262
final,
6363
true)
@@ -103,7 +103,7 @@ end
103103
Similar to `Test.@testset args...`, but the contained tests are not run immediately,
104104
and are instead stored for later execution, triggered by `runtests()`.
105105
Invocations of `@testset` can be nested, but qualified invocations of
106-
`InlineTest.@testset` can't.
106+
`ReTest.@testset` can't.
107107
Internally, `@testset` invocations are converted to `Test.@testset` at execution time.
108108
"""
109109
macro testset(args...)
@@ -157,7 +157,7 @@ function runtests(m::Module, pattern::Union{AbstractString,Regex} = r""; wrap::B
157157
string('/', desc, final ? "" : "/"))
158158

159159
if wrap
160-
Core.eval(m, :(InlineTest.Test.@testset $("Tests for module $m") begin
160+
Core.eval(m, :(ReTest.Test.@testset $("Tests for module $m") begin
161161
$(map(ts -> wrap_ts(partial, regex, ts), tests(m))...)
162162
end))
163163
else
@@ -206,7 +206,7 @@ function wrap_ts(partial, regex, ts::TestsetExpr, loopvals=nothing)
206206
let $(Testset.REGEX[]) = ($partial, $regex),
207207
$(Testset.FINAL[]) = $(ts.final)
208208

209-
InlineTest.@testsetr $(ts.desc) for $(ts.loops.args[1]) in $loopvals
209+
ReTest.@testsetr $(ts.desc) for $(ts.loops.args[1]) in $loopvals
210210
$(ts.body)
211211
end
212212
end
@@ -218,10 +218,10 @@ function runtests(pattern::Union{AbstractString,Regex} = r""; wrap::Bool=true)
218218
for mods in (values(Base.loaded_modules), TESTED_MODULES)
219219
# TESTED_MODULES is not up-to-date w.r.t. package modules which have
220220
# precompilation, so we have to also look in Base.loaded_modules
221-
# TODO: look recursively in "loaded modules" which use InlineTest for sub-modules
221+
# TODO: look recursively in "loaded modules" which use ReTest for sub-modules
222222
foreach(mods) do m
223223
if isdefined(m, INLINE_TEST[])
224-
# will automatically skip InlineTest and InlineTest.InlineTestTest
224+
# will automatically skip ReTest and ReTest.ReTestTest
225225
runtests(m, pattern, wrap=wrap)
226226
end
227227
end
@@ -236,20 +236,20 @@ function partialize(r::Regex)
236236
end
237237
end
238238

239-
module InlineTestTest
239+
module ReTestTest
240240

241-
using ..InlineTest
241+
using ..ReTest
242242
@testset "test Test in sub-module" begin
243243
@test 1 == 1
244244
end
245245

246-
end # module InlineTestTest
246+
end # module ReTestTest
247247

248248
@testset "self test" begin
249249
@assert typeof(@__MODULE__) == Module
250250
@test 1 != 2
251-
runtests(InlineTestTest)
252-
runtests(InlineTestTest, wrap=true)
251+
runtests(ReTestTest)
252+
runtests(ReTestTest, wrap=true)
253253
end
254254

255-
end # module InlineTest
255+
end # module ReTest

src/testset.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using Test: DefaultTestSet, Error, Test, _check_testset, finish, get_testset,
88
using Random: Random, default_rng
99

1010
const REGEX = Ref{Symbol}()
11-
const FINAL = Ref{Symbol}(:__FINAL__) # must have a value at compile time for InlineTestTest
11+
const FINAL = Ref{Symbol}(:__FINAL__) # must have a value at compile time for ReTestTest
1212

1313
function __init__()
1414
REGEX[] = gensym()

test/runtests.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
using InlineTest
1+
using ReTest
22

33
module M
4-
using InlineTest
4+
using ReTest
55

66
RUN = []
77

@@ -78,7 +78,7 @@ runtests(M, wrap=true) # TODO: more precise tests
7878
runtests(M, wrap=false)
7979

8080
module N
81-
using InlineTest
81+
using ReTest
8282

8383
RUN = []
8484

@@ -122,7 +122,7 @@ N.check("^/i/j0", ["i"])
122122
N.check("^/i/l10", ["i"])
123123

124124
module P
125-
using InlineTest
125+
using ReTest
126126

127127
RUN = []
128128

@@ -149,7 +149,7 @@ function check(rx, list)
149149
end
150150
end
151151

152-
import .P # test InlineTest's wrapping of non-regex patterns
152+
import .P # test ReTest's wrapping of non-regex patterns
153153
P.check("b", ["a", "b", "b|c"]) # an implicit prefix r".*" is added
154154
P.check("b|c", ["a", "b|c"]) # "b" is not matched
155155

0 commit comments

Comments
 (0)