(.module: [lux #* ["_" test (#+ Test)] [abstract [monad (#+ do)]] [control ["." try (#+ Try) ("#@." functor)] [concurrency ["." promise (#+ Promise)]] [security ["!" capability]]] [data ["." binary] ["." text ("#@." equivalence) ["%" format] ["." encoding]]] [math ["." random (#+ Random)]] [world ["." file (#+ File)]]] [// ["@." profile]] {#program ["." / ["/#" // #_ ["#" profile (#+ Profile)] ["#." project] ["#." action] ["#." format]]]}) (def: #export test Test (<| (_.covering /._) (do {! random.monad} [expected (:: ! map (set@ #//.parents (list)) @profile.random) #let [fs (: (file.System Promise) (file.mock (:: file.default separator)))]] (wrap (do promise.monad [verdict (do //action.monad [file (: (Promise (Try (File Promise))) (file.get-file promise.monad fs //project.file)) _ (|> expected //format.profile %.code encoding.to-utf8 (!.use (:: file over-write))) actual (: (Promise (Try Profile)) (/.read promise.monad fs //.default))] (wrap (:: //.equivalence = expected actual)))] (_.claim [/.read] (try.default false verdict)))))))