(.require [library [lux (.except) [control ["[0]" try] ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format]] [format ["md" markdown]]] ["[0]" meta (.only) ["[0]" symbol] ["[0]" code (.only) ["<[1]>" \\parser]] [macro [syntax (.only syntax)] ["[0]" template] ["[0]" expansion]]] [test ["_" property (.only Test)]]]] [\\library ["[0]" /]] ["[0]" / ["[1][0]" remember]]) (def macro_error (syntax (_ [macro .any]) (function (_ compiler) {try.#Success [compiler (list (code.bit (when ((expansion.complete macro) compiler) {try.#Failure error} true {try.#Success _} false)))]}))) (def description (syntax (_ []) (at meta.monad each (|>> %.nat code.text list) meta.seed))) (with_expansions ['definition_description' (..description) 'module_description' (..description) g!default (..description) g!default (template.symbol [g!default]) g!default+ (template.symbol [.._] [g!default])] (these (def .public g!default Nat 123) (def .public test Test (<| (_.covering /._) (let [module (`` (/.module .._ (,, (template.text ['module_description'])))) definition (`` (/.definition g!default+ 'definition_description'))]) (all _.and (_.for [/.markdown] (all _.and (_.for [/.Module] (_.coverage [/.module] (and (let [[expected _] (symbol .._)] (text.contains? expected (/.markdown (list module)))) (text.contains? (template.text ['module_description']) (/.markdown (list module)))))) (_.for [/.Definition] (_.coverage [/.definition] (and (text.contains? (template.text ['definition_description']) (/.markdown (list module definition))) (text.contains? (template.text [g!default+]) (/.markdown (list module definition)))))) )) (_.coverage [/.unqualified_symbol] (`` (and (,, (with_template [] [(macro_error )] [(/.definition g!default)] [(/.definition g!default (,, (template.text ['definition_description'])))] ))))) /remember.test )))))