-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c94999
commit 6f5f201
Showing
5 changed files
with
215 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,16 @@ XLSX = "fdbf4ff8-1666-58a4-91e7-1b58723a45e0" | |
[compat] | ||
CSV = "0.10" | ||
DataFrames = "1" | ||
Git = "1" | ||
JuliaFormatter = "1" | ||
Logging = "1.6" | ||
Missings = "1" | ||
Phylo = "0.5" | ||
PhyloNetworks = "0.16" | ||
Statistics = "1" | ||
Pkg = "1.6" | ||
ResearchSoftwareMetadata = "0.1.1" | ||
Statistics = "1.6" | ||
Test = "1.6" | ||
Unitful = "1" | ||
XLSX = "0.10" | ||
julia = "1.6.7" | ||
|
@@ -34,7 +40,12 @@ email = "[email protected]" | |
ror = "00vtgdb53" | ||
|
||
[extras] | ||
Git = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2" | ||
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" | ||
ResearchSoftwareMetadata = "58378933-4625-47fa-851e-05ee27d397bd" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Test"] | ||
test = ["Git", "JuliaFormatter", "Logging", "Pkg", "ResearchSoftwareMetadata", "Test"] |
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,8 +1,158 @@ | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
using TraitExtraction | ||
using Test | ||
using TraitExtraction | ||
using Pkg | ||
|
||
rsmd = get(ENV, "RSMD_CROSSWALK", "FALSE") | ||
|
||
if rsmd == "FALSE" | ||
# Normal testing | ||
|
||
# Identify files in test/ that are testing matching files in src/ | ||
# - src/Source.jl will be matched by test/test_Source.jl | ||
filebase = String[] | ||
for (root, dirs, files) in walkdir("../src") | ||
append!(filebase, | ||
map(file -> replace(file, r"(.*).jl" => s"\1"), | ||
filter(file -> occursin(r".*\.jl", file), files))) | ||
end | ||
|
||
testbase = map(file -> replace(file, r"test_(.*).jl" => s"\1"), | ||
filter(str -> occursin(r"^test_.*\.jl$", str), readdir())) | ||
|
||
# Identify tests with no matching file | ||
superfluous = filter(f -> f ∉ filebase, testbase) | ||
if length(superfluous) > 0 | ||
println() | ||
@info "Potentially superfluous tests:" | ||
for f in superfluous | ||
println(" + $f.jl") | ||
end | ||
println() | ||
end | ||
|
||
# Identify files with no matching test | ||
notest = filter(f -> f ∉ testbase, filebase) | ||
if length(notest) > 0 | ||
println() | ||
@info "Potentially missing tests:" | ||
for f in notest | ||
println(" - $f.jl") | ||
end | ||
println() | ||
end | ||
|
||
# Identify files in test/ that are testing matching files in ext/ | ||
# - ext/SourceExt.jl will be matched by test/ext_SourceExt.jl | ||
filebase = String[] | ||
for (root, dirs, files) in walkdir("../ext") | ||
append!(filebase, | ||
map(file -> replace(file, r"(.*).jl" => s"\1"), | ||
filter(file -> occursin(r".*\.jl", file), files))) | ||
end | ||
|
||
extbase = map(file -> replace(file, r"ext_(.*).jl" => s"\1"), | ||
filter(str -> occursin(r"^ext_.*\.jl$", str), readdir())) | ||
|
||
# Identify tests with no matching file | ||
superfluous = filter(f -> f ∉ filebase, extbase) | ||
if length(superfluous) > 0 | ||
println() | ||
@info "Potentially superfluous extension tests:" | ||
for f in superfluous | ||
println(" + $f.jl") | ||
end | ||
println() | ||
end | ||
|
||
# Identify files with no matching test | ||
notest = filter(f -> f ∉ extbase, filebase) | ||
if length(notest) > 0 | ||
println() | ||
@info "Potentially missing extension tests:" | ||
for f in notest | ||
println(" - $f.jl") | ||
end | ||
println() | ||
end | ||
|
||
@testset "TraitExtraction.jl" begin | ||
@test isfile(TraitExtraction.path("runtests.jl")) | ||
println() | ||
@info "Running tests for files:" | ||
for t in testbase | ||
println(" = $t.jl") | ||
end | ||
println() | ||
|
||
@info "Running tests..." | ||
@testset for t in testbase | ||
fn = "test_$t.jl" | ||
println(" * Testing $t.jl ...") | ||
include(fn) | ||
end | ||
|
||
println() | ||
@info "Running tests for extensions:" | ||
for t in extbase | ||
println(" = $t.jl") | ||
end | ||
println() | ||
|
||
@info "Running extension tests..." | ||
@testset for t in extbase | ||
fn = "ext_$t.jl" | ||
println(" * Testing $t.jl extension...") | ||
include(fn) | ||
end | ||
end | ||
|
||
# Identify files that are cross-validating results against other packages | ||
# test/pkg_Package.jl should validate results against the Package package | ||
|
||
pkgbase = map(file -> replace(file, r"pkg_(.*).jl$" => s"\1"), | ||
filter(str -> occursin(r"^pkg_.*\.jl$", str), | ||
readdir())) | ||
|
||
if length(pkgbase) > 0 | ||
@info "Cross validation packages:" | ||
@testset begin | ||
for p in pkgbase | ||
println(" = $p") | ||
end | ||
println() | ||
|
||
@testset for p in pkgbase | ||
fn = "pkg_$p.jl" | ||
println(" * Validating $p.jl ...") | ||
include(fn) | ||
end | ||
end | ||
end | ||
end | ||
|
||
if rsmd == "TRUE" || !haskey(ENV, "RUNNER_OS") # Crosswalk runner or local testing | ||
# Test RSMD crosswalk and other hygene issues | ||
|
||
# Identify files that are checking package hygene | ||
cleanbase = map(file -> replace(file, r"clean_(.*).jl$" => s"\1"), | ||
filter(str -> occursin(r"^clean_.*\.jl$", str), | ||
readdir())) | ||
|
||
if length(cleanbase) > 0 | ||
@info "Crosswalk and clean testing:" | ||
@testset begin | ||
for c in cleanbase | ||
println(" = $c") | ||
end | ||
println() | ||
|
||
@testset "TraitExtraction.jl" begin | ||
# Write your tests here. | ||
@testset for c in cleanbase | ||
fn = "clean_$c.jl" | ||
println(" * Verifying $c.jl ...") | ||
include(fn) | ||
end | ||
end | ||
end | ||
end |