From cb9a545cadd20cbe708f947f5d12885e0d382f07 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 9 Jan 2025 11:59:30 +0100 Subject: [PATCH] Restore example file --- .gitignore | 1 + test.clj | 20 ++++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index a943c431f..6c001c652 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ pom.xml.asc **/*/*.ipynb_checkpoints concepts/functions-generating-functions/introduction_files/ concepts/functions-generating-functions/*.html +exercises/**/*.bak diff --git a/test.clj b/test.clj index 8b30fd737..3d1aec54d 100755 --- a/test.clj +++ b/test.clj @@ -35,14 +35,18 @@ example (if practice? (str dir ".meta/example.clj") (str dir ".meta/exemplar.clj")) - src (str dir "src/" (->snake_case slug) ".clj")] - (shell/sh "cp" example src) - (= "pass" ((json/parse-string - (:out (shell/sh (str test-runner-dir "test-runner.clj") - slug - dir - dir))) - "status")))) + src (str dir "src/" (->snake_case slug) ".clj") + src-copy (str src ".bak")] + (shell/sh "cp" src src-copy) + (try + ((shell/sh "cp" example src) + (= "pass" ((json/parse-string + (:out (shell/sh (str test-runner-dir "test-runner.clj") + slug + dir + dir))) + "status"))) + (finally (shell/sh "mv" src-copy src))))) (defn test-exercises! [] (let [exercises (or (seq (take 1 *command-line-args*))