tricu

An interpreted language for exploring Tree Calculus
Log | Files | Refs | README | LICENSE

consumer_data_lines_pinned.tri (1749B)


      1 -- Focused deployment checks: real configured SCP input failures, plus one
      2 -- tiny source-compiled worker that fails after a successful file read.
      3 !import "prelude" !Local
      4 !import "io" !Local
      5 !import "source.module" M
      6 !import "consumers.unit-compile" U
      7 !import "consumers.lexical-worker" L
      8 !import "consumers.structural" S
      9 !import "consumers.file" File
     10 root = "__ROOT__"
     11 scenario = do onOk_
     12   invoke <- M.sourceModuleLoadSelected root "__INVOCATIONS__" "dataLines"
     13   rows <- pure (U.compileScpUnit "consumer emptyOnly\n [] @ _ => []" [])
     14   row <- pure (ok (snd (head rows)) t)
     15   worker <- pure (ok (L.lWorker t (fst row)) t)
     16   manifest <- M.sourceModulePublishNames root
     17     [(pair "processFile" (path : File.program "data-lines" (input : L.lRunChecked worker input) path))]
     18     ["processFile"]
     19   let failed = L.lRunChecked worker "alpha" in
     20   let oracle = S.runConsumer (fst (snd row)) "alpha" in
     21   let checks = foldl and? true [
     22         (equal? (File.detail "no matching consumer rule") "no matching consumer rule")
     23         (equal? (File.detail (pair 65 (t t))) "<non-text tree; inspect Result>")
     24         (equal? (File.tagResult "consumer" (err (t t) t))
     25           (err (pair "consumer" (t t)) t))
     26         (equal? (invoke []) (ok [] t))
     27         (equal? (invoke (t t)) (err "no matching consumer rule" t))
     28         (equal? (invoke (pair 65 (t t))) (err "no matching consumer rule" t))
     29         (equal? failed (err "no matching consumer rule" t))
     30         (equal? failed oracle)] in
     31   pure (lazyBool (_ : ok manifest t) (_ : err "pinned-file-checks-failed" t) checks)
     32 main = io (onResult_ scenario
     33   (problem : pure problem)
     34   (manifest : do bind
     35     _ <- putStrLn (append "failing-file-manifest=" manifest)
     36     putStrLn "pinned-file-checks-ok"))
     37 main