consumer_text_summary_bundle_run.tri (1450B)
1 -- Both exports were independently packed, imported, and loaded before reads. 2 !import "source.module" !Local 3 !import "consumers.text-summary" T 4 !import "consumers.comparison.text-summary-lambda" L 5 !import "io" !Local 6 !import "prelude" !Local 7 store = "__STORE__" 8 root = "__ROOT__" 9 check scp lambda path expected = bind (scp path) (a : bind (lambda path) (b : pure (and? (equal? (T.render a) expected) (equal? (T.render a) (L.render b))))) 10 runChecks scp lambda = bind (check scp lambda (append root "/two.txt") "lines: 2") (found : bind (check scp lambda (append root "/empty.txt") "lines: 0") (empty : bind (scp (append root "/absent.txt")) (missing : bind (lambda (append root "/absent.txt")) (other : putStrLn (matchBool "text-summary-bundle-ok" "text-summary-bundle-DIFFER" (foldl and? true [found empty (equal? (fst missing) 0) (equal? (T.render missing) (L.render other))])))))) 11 main = io (onResult_ (sourceModuleLoadSelected store "textSummary" "scpSummary") 12 (problem : putStrLn (append "scp-load-error=" problem)) 13 (scp : onResult_ (sourceModuleLoadSelected store "lambdaSummary" "lambdaSummary") 14 (problem : putStrLn (append "lambda-load-error=" problem)) 15 (lambda : onResult_ (sourceModuleLoadSelected store "textSummary" "counterProgram") 16 (problem : putStrLn (append "source-sidecar-error=" problem)) 17 (source : lazyBool (_ : putStrLn "source-sidecar-empty") 18 (_ : runChecks scp lambda) (equal? source t))))) 19 main