Skip to content

Commit c6bfa59

Browse files
committed
tests: add reference files for julia@1.6.7
Some tests only run for older Julia versions, these reference files are thus only generated for the first time when run with an older julia version.
1 parent 62479ea commit c6bfa59

File tree

5 files changed

+57
-5
lines changed

5 files changed

+57
-5
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
```julia
3+
g()
4+
g(x)
5+
g(x, y)
6+
g(x, y, z; kwargs...)
7+
8+
```
9+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
```julia
3+
g()
4+
g(x)
5+
6+
```
7+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
```julia
3+
h(x::Int64) -> Int64
4+
5+
```
6+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
```julia
3+
k_7(
4+
x::Union{Nothing, T} where T<:Integer
5+
) -> Union{Nothing, Integer}
6+
k_7(
7+
x::Union{Nothing, T} where T<:Integer,
8+
y::Integer
9+
) -> Union{Nothing, T} where T<:Integer
10+
11+
```
12+

test/tests.jl

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,29 @@ ro_path(fn) = joinpath(@__DIR__, "reference_outputs", fn)
119119
str = @io2str with_test_repo() do
120120
DSE.format(METHODLIST, ::IO, doc)
121121
end
122-
remove_local_info = x -> replace(
123-
x,
124-
r"(defined at \[`).+(DocStringExtensions.jl/test/TestModule)" => s"\1[...]\2",
125-
r"(tree/).+(/M)" => s"\1[...]\2"
126-
)
122+
# split into multiple replace() calls for older
123+
# versions of julia where the replace(s, r => s, r => s...)
124+
# method is missing
125+
remove_local_info = x -> begin
126+
x = replace(
127+
x,
128+
# remove the part of the path that precedes DocStringExtensions.jl/...
129+
# because it will differ per machine
130+
r"(defined at \[`).+(DocStringExtensions.jl/test/TestModule)" => s"\1[...]\2",
131+
)
132+
replace(
133+
x,
134+
# Remove the git hash because it will differ per
135+
# test run
136+
r"(tree/).+(/M)" => s"\1[...]\2"
137+
)
138+
end
139+
# the replacements are needed because the local
140+
# Git repo created by with_test_repo() will have
141+
# a different commit hash each time the test suite is run
142+
# and METHODLIST displays that. Reference tests will fail every
143+
# time if we don't remove the hash and the local part of the
144+
# path
127145
@test_reference ro_path("method_lists.txt") remove_local_info(str)
128146
end
129147

0 commit comments

Comments
 (0)