From 490a590a3dfcebff328b0617b3910f3d34dbba8e Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Mon, 15 Jan 2018 13:23:44 -0700 Subject: [PATCH 1/3] Only test at top level in exercises dir We don't need to recursively walk the file tree, since only the directories that live directly within the exercises/ directory are actually exercises. --- .gitignore | 1 + runtests.jl | 49 ++++++++++++++++++++++++------------------------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 6a513a061947e..70bbd4ecd1e92 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .DS_Store bin/configlet bin/configlet.exe +tmp/ diff --git a/runtests.jl b/runtests.jl index 4aad3283f10da..ff116cca69b9e 100644 --- a/runtests.jl +++ b/runtests.jl @@ -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 From d26d416dc7ba09cf8a347bba31b8bc71ad45e68d Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Sun, 14 Jan 2018 18:14:23 -0700 Subject: [PATCH 2/3] Rename deprecated hints files The ./exercises/:slug/HINTS.md file has been deprecated in favor of the ./exercises/:slug/.meta/hints.md file. --- exercises/complex-numbers/{HINTS.md => .meta/hints.md} | 0 exercises/custom-set/{HINTS.md => .meta/hints.md} | 0 exercises/robot-name/{HINTS.md => .meta/hints.md} | 0 exercises/rotational-cipher/{HINTS.md => .meta/hints.md} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename exercises/complex-numbers/{HINTS.md => .meta/hints.md} (100%) rename exercises/custom-set/{HINTS.md => .meta/hints.md} (100%) rename exercises/robot-name/{HINTS.md => .meta/hints.md} (100%) rename exercises/rotational-cipher/{HINTS.md => .meta/hints.md} (100%) diff --git a/exercises/complex-numbers/HINTS.md b/exercises/complex-numbers/.meta/hints.md similarity index 100% rename from exercises/complex-numbers/HINTS.md rename to exercises/complex-numbers/.meta/hints.md diff --git a/exercises/custom-set/HINTS.md b/exercises/custom-set/.meta/hints.md similarity index 100% rename from exercises/custom-set/HINTS.md rename to exercises/custom-set/.meta/hints.md diff --git a/exercises/robot-name/HINTS.md b/exercises/robot-name/.meta/hints.md similarity index 100% rename from exercises/robot-name/HINTS.md rename to exercises/robot-name/.meta/hints.md diff --git a/exercises/rotational-cipher/HINTS.md b/exercises/rotational-cipher/.meta/hints.md similarity index 100% rename from exercises/rotational-cipher/HINTS.md rename to exercises/rotational-cipher/.meta/hints.md From dd512f2823a1548baeb53fce5847bcacee3285f3 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Mon, 15 Jan 2018 13:26:41 -0700 Subject: [PATCH 3/3] Delete extraneous empty file --- exercises/.keep | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 exercises/.keep diff --git a/exercises/.keep b/exercises/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000