Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions test/test_util.jl
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
using TrixiTest: @trixi_test_nowarn
using TrixiBase: trixi_include
using TrixiTest: @test_trixi_include_base

# Use a macro to avoid world age issues when defining new initial conditions etc.
# inside an example.
"""
@test_trixi_include(example)
@test_trixi_include(example, args...)

Test by calling `trixi_include(example; parameters...)`.
Test by calling `trixi_include(example; args...)`.
By default, only the absence of error output is checked.

This is a thin wrapper around `TrixiTest.@test_trixi_include_base`, analogous to the
one Trixi.jl uses in its `test/test_trixi.jl`.
"""
macro test_trixi_include(example, args...)
local kwargs = Pair{Symbol, Any}[]
for arg in args
if arg.head == :(=)
push!(kwargs, Pair(arg.args...))
end
end

quote
println("═"^100)
println($example)

# evaluate examples in the scope of the module they're called from
@trixi_test_nowarn trixi_include(@__MODULE__, $example; $kwargs...)

println("═"^100)
ex = quote
@test_trixi_include_base($example, $(args...))
end
return esc(ex)
end
Loading