(.using [library [lux (.full) [abstract [monad (.only do)]] [control [try (.only Try)] [concurrency ["[0]" async (.only Async) ("[1]#[0]" monad)]]] [data [collection ["[0]" dictionary]]] [macro ["^" pattern]] [math [number ["i" int]]] [world ["[0]" program (.only Program)] ["[0]" file] ["[0]" shell (.only Exit Shell)] ["[0]" console (.only Console)]]]] ["[0]" // "_" ["[1][0]" build] ["/[1]" // "_" ["[1]" profile] ["[1][0]" action] ["[1][0]" command (.only Command)] ["[1][0]" runtime] [dependency [resolution (.only Resolution)]]]]) (def: .public start "[TEST STARTED]") (def: .public success "[TEST ENDED]") (def: .public failure "[TEST FAILED]") (def: .public (do! console program fs shell resolution profile) (-> (Console Async) (Program Async) (file.System Async) (Shell Async) Resolution (Command [Exit Any])) (do async.monad [environment (program.environment async.monad program) .let [working_directory (# program directory)]] (do [! ///action.monad] [.let [home (# program home)] [build_exit compiler program] (//build.do! console program fs shell resolution (has ///.#program (the ///.#test profile) profile))] (if (i.= shell.normal build_exit) (do ! [_ (is (Async (Try Any)) (console.write_line ..start console)) .let [host_dependencies (//build.host_dependencies fs home resolution) [command_environment test_command test_parameters] (case compiler {//build.#JVM dependency} (|> program (///runtime.for (the ///.#java profile)) (//build.with_jvm_class_path host_dependencies)) (^.template [ ] [{ artifact} (///runtime.for (the profile) program)]) ([//build.#JS ///.#js] [//build.#Python ///.#python] [//build.#Lua ///.#lua] [//build.#Ruby ///.#ruby]))] process (# shell execute [(dictionary.composite environment command_environment) working_directory test_command test_parameters]) _ (//build.log_output! console process) _ (//build.log_error! console process) exit (# process await []) _ (is (Async (Try Any)) (console.write_line (if (i.= shell.normal exit) ..success ..failure) console))] (in [exit []])) (in [build_exit []])))))