Last active
August 29, 2015 14:03
-
-
Save svetlyak40wt/fff6f40d1534608cda0c to your computer and use it in GitHub Desktop.
Фреймворк для юнит-тестирования на jisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(= tests `()) | |
(def pr line | |
(process.stdout.write line)) | |
(def prn line | |
(pr (+ line "\n"))) | |
(mac test name ...body | |
`(do (tests.push (list ,(JSON.stringify name) ,name)) | |
(def ,name (do ,...body)))) | |
(def eq left right | |
(if (!= left right) | |
(throw (Error (+ "Assertion error:" left " != " right))))) | |
(def run_tests | |
(for item tests | |
(do | |
(pr (+ "processing " item[0] "...")) | |
(try (do (item[1]) | |
(prn "OK")) | |
(catch err (do (prn "ERROR") | |
(prn err))))))) | |
(test arithmetic | |
(eq 3 (+ 2 1)) | |
(eq 4 (* 2 1))) | |
(run_tests) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment