Skip to content

Commit dd88a53

Browse files
committed
add include macro, bump minor version
1 parent 1e6d07e commit dd88a53

File tree

5 files changed

+18
-1
lines changed

5 files changed

+18
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TestExtras"
22
uuid = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
33
authors = ["Jutho Haegeman <[email protected]> and contributors"]
4-
version = "0.2.2"
4+
version = "0.3"
55

66
[deps]
77
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

src/TestExtras.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ module TestExtras
22

33
export @constinferred, @constinferred_broken
44
export @timedtestset
5+
export @include
56
export ConstInferred
67

78
include("constinferred.jl")
9+
include("includemacro.jl")
10+
811
if VERSION >= v"1.8"
912
include("timedtest_new.jl")
1013
else

src/includemacro.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# include file as-is in local scope
2+
macro include(filename::String)
3+
dir = dirname(string(__source__.file))
4+
filepath = joinpath(dir, filename)
5+
source = "quote; " * read(filepath, String) * "; end"
6+
return esc(Meta.parse(source).args[1])
7+
end

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,8 @@ end
127127
@test a === 1
128128
end
129129
end
130+
const constval = false
131+
@timedtestset "@include" begin
132+
val = true
133+
@include("testinclude.jl")
134+
end

test/testinclude.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@test val
2+
@test_broken constval

0 commit comments

Comments
 (0)