(.using [library [lux "*" ["_" test {"+" Test}] [abstract [monad {"+" do}]] [control ["[0]" try ("[1]#[0]" functor)] [concurrency ["[0]" async]]] [data ["[0]" binary ("[1]#[0]" equivalence)] ["[0]" text ("[1]#[0]" equivalence) [encoding ["[0]" utf8]]] [format ["[0]" xml]]] [math ["[0]" random]] [world ["[0]" file]]]] [// ["@[0]" version] [// ["@[0]" profile]]] [\\program ["[0]" / ["//[1]" /// "_" ["[1]" profile] ["[1][0]" action] ["[1][0]" pom]]]]) (def: .public test Test (<| (_.covering /._) (do random.monad [sample @profile.random .let [fs (file.mock (# file.default separator))]] (in (do [! async.monad] [.let [console (@version.echo "")] outcome (/.do! console fs sample)] (case outcome {try.#Success _} (do ! [verdict (do ///action.monad [expected (|> (///pom.write sample) (try#each (|>> (# xml.codec encoded) (# utf8.codec encoded))) (# ! in)) actual (# fs read ///pom.file) logging! (# ///action.monad each (text#= /.success) (# console read_line [])) .let [expected_content! (binary#= expected actual)]] (in (and logging! expected_content!)))] (_.cover' [/.do! /.success] (try.else false verdict))) {try.#Failure error} (_.cover' [/.do!] (case (the ///.#identity sample) {.#Some _} false {.#None} true))))))))