Skip to content

Commit

Permalink
Run the tests with the latest version of the template
Browse files Browse the repository at this point in the history
  • Loading branch information
abelsiqueira committed May 21, 2024
1 parent 92cab62 commit e1ff0d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/COPIERTemplate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function generate(path, generate_missing_uuid = true; kwargs...)
if generate_missing_uuid && !("PackageUUID" in keys(data))
data["PackageUUID"] = string(uuid4())
end
copier.run_copy("https://github.com/abelsiqueira/COPIERTemplate.jl", path; kwargs..., data = data)
copier.run_copy(joinpath(@__DIR__, ".."), path; kwargs..., data = data, vcs_ref = "HEAD")
end

end
11 changes: 7 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,19 @@ template_options = Dict(

COPIERTemplate.generate(tmpdir1; data = template_options, vcs_ref = "main")
bash_args = vcat([["-d"; "$k=$v"] for (k, v) in template_options]...)
run(
`copier copy --vcs-ref main $bash_args https://github.com/abelsiqueira/COPIERTemplate.jl $tmpdir2`,
)
ignore(line) = startswith("_commit")(line) || startswith("_src_path")(line)
template_path = joinpath(@__DIR__, "..")
run(`copier copy --vcs-ref HEAD $bash_args $template_path $tmpdir2`)
for (root, dirs, files) in walkdir(tmpdir1)
for file in files
file1 = joinpath(root, file)
file2 = replace(file1, tmpdir1 => tmpdir2)
lines1 = readlines(file1)
lines2 = readlines(file2)
diff = ["$line1 vs $line2" for (line1, line2) in zip(lines1, lines2) if line1 != line2]
diff = [
"$line1 vs $line2" for
(line1, line2) in zip(lines1, lines2) if !ignore(line1) && line1 != line2
]
@test diff == []
end
end
Expand Down

0 comments on commit e1ff0d6

Please sign in to comment.