-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If selected, AutoIncludeTests will add a snippet in runtests.jl that reads through all test-*.jl files and include them inside a @testset. Because of this, test/runtests.jl is not ignored anymore. Closes #261
- Loading branch information
1 parent
6202b00
commit 60613df
Showing
7 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,27 @@ | ||
using {{ PackageName }} | ||
using Test | ||
|
||
{% if AutoIncludeTests %} | ||
#= | ||
Don't add your tests to runtests.jl. Instead, create files named | ||
|
||
test-title-for-my-test.jl | ||
|
||
The file will be automatically included inside a `@testset` with title "Title For My Test". | ||
=# | ||
for (root, dirs, files) in walkdir(@__DIR__) | ||
for file in files | ||
if isnothing(match(r"^test-.*\.jl$", file)) | ||
continue | ||
end | ||
title = titlecase(replace(splitext(file[6:end])[1], "-" => " ")) | ||
@testset "$title" begin | ||
include(title) | ||
end | ||
end | ||
end | ||
{% else %} | ||
@testset "{{ PackageName }}.jl" begin | ||
@test {{ PackageName }}.hello_world() == "Hello, World!" | ||
end | ||
{% endif %} |
3 changes: 3 additions & 0 deletions
3
template/test/{% if AutoIncludeTests %}test-basic-test.jl{% endif %}.jinja
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@testset "{{ PackageName }}.jl" begin | ||
@test {{ PackageName }}.hello_world() == "Hello, World!" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters