Skip to content

Commit

Permalink
Merge pull request #43 from jbytecode/main
Browse files Browse the repository at this point in the history
add example_checker.jl for checking if examples are not broken
  • Loading branch information
Kevin-Mattheus-Moerman authored Jan 12, 2025
2 parents 171f13f + b703392 commit 3048057
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/demo_gridpoints.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Comodo
using Comodo.GLMakie
using Comodo.LinearAlgebra

#=
This demo shows the use of the gridpoints function. This function can be used to create
Expand Down
1 change: 1 addition & 0 deletions examples/demo_surface_mesh_smoothing.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Comodo
using Comodo.GLMakie
using Comodo.GeometryBasics
using Comodo.Statistics
using FileIO, Random

Random.seed!(1) # Set seed so demo performs the same each time
Expand Down
1 change: 1 addition & 0 deletions examples/demo_vertexnormal.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Comodo
using Comodo.GLMakie
using Comodo.GeometryBasics
using Comodo.Statistics
using FileIO

#=
Expand Down
39 changes: 39 additions & 0 deletions examples/example_checker.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module ExampleChecker

function load_and_run!(filename::String, problems::Vector{String})::Bool
cmdline = "using Pkg; Pkg.activate(\"./..\"); include(\"$filename\")"
command = `julia -e $cmdline`
try
result = run(command)
if result.exitcode != 0
push!(problems, filename)
return false
end
return true
catch e
push!(problems, filename)
return false
end
end

function main()
dircontent = readdir(".")
juliafiles = filter(x -> occursin(r"demo.*\.jl", x), dircontent)

problems = Vector{String}(undef, 0)

for file in juliafiles
println("Checking file: $file")
load_and_run!(file, problems)
end

@info "Here is the list of problematic files:"
display(problems)
end

function __init__()
@info "Module initialized, running main"
main()
end

end # end of module

0 comments on commit 3048057

Please sign in to comment.