Skip to content

Commit

Permalink
Merge pull request JuliaLang#101 from exercism/kytrinyx/hints
Browse files Browse the repository at this point in the history
Rename deprecated hints files
  • Loading branch information
SaschaMann authored Jan 18, 2018
2 parents 989d66e + dd512f2 commit 717f68c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.DS_Store
bin/configlet
bin/configlet.exe
tmp/
Empty file removed exercises/.keep
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
49 changes: 24 additions & 25 deletions runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,31 @@ macro test_broken(ex)
@test eval(current_module(), ex)
end

for (root, dirs, files) in walkdir("exercises")
for exercise in dirs
# Allow only testing specified execises
if !isempty(ARGS) && !(exercise in ARGS)
continue
end
for exercise in readdir("exercises")
# Allow only testing specified execises
if !isempty(ARGS) && !(exercise in ARGS)
continue
end

exercise_path = joinpath("exercises", exercise)
isdir(exercise_path) || continue

# Create temporary directory
temp_path = mktempdir(".")

# Copy tests & example to the temporary directory
cp(joinpath(exercise_path, "example.jl"), joinpath(temp_path, "$exercise.jl"))
cp(joinpath(exercise_path, "runtests.jl"), joinpath(temp_path, "runtests.jl"))

exercise_path = joinpath("exercises", exercise)

# Create temporary directory
temp_path = mktempdir(root)

# Copy tests & example to the temporary directory
cp(joinpath(exercise_path, "example.jl"), joinpath(temp_path, "$exercise.jl"))
cp(joinpath(exercise_path, "runtests.jl"), joinpath(temp_path, "runtests.jl"))

try
# Run the tests
@testset "$exercise example" begin
# Run the tests within an anonymous module to prevent definitions from
# one exercise leaking into another.
eval(Module(), :(include(joinpath($temp_path, "runtests.jl"))))
end
finally
# Delete the temporary directory
rm(temp_path, recursive=true)
try
# Run the tests
@testset "$exercise example" begin
# Run the tests within an anonymous module to prevent definitions from
# one exercise leaking into another.
eval(Module(), :(include(joinpath($temp_path, "runtests.jl"))))
end
finally
# Delete the temporary directory
rm(temp_path, recursive=true)
end
end

0 comments on commit 717f68c

Please sign in to comment.