aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/command/version.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-12-03 02:09:57 -0400
committerEduardo Julian2020-12-03 02:09:57 -0400
commit0205e5146b50ab066d152fccda0fc8cef4eef852 (patch)
treeda2d89132da8f09344e26db78d0e43ca1095ee7f /stdlib/source/test/aedifex/command/version.lux
parent28c724857d76afdc40b5b036f415cc151eb66263 (diff)
Detect duplicate files coming from dependencies.
Diffstat (limited to 'stdlib/source/test/aedifex/command/version.lux')
-rw-r--r--stdlib/source/test/aedifex/command/version.lux61
1 files changed, 56 insertions, 5 deletions
diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux
index f6196556d..5e60f6b9b 100644
--- a/stdlib/source/test/aedifex/command/version.lux
+++ b/stdlib/source/test/aedifex/command/version.lux
@@ -5,23 +5,74 @@
[monad (#+ do)]]
[control
["." try]
+ ["." exception (#+ exception:)]
[concurrency
- ["." promise]]]
+ ["." promise (#+ Promise)]]
+ [security
+ ["!" capability]]]
+ [data
+ ["." maybe]
+ ["." text ("#\." equivalence)
+ ["%" format (#+ format)]]]
[math
- ["." random]]]
+ ["." random]]
+ [tool
+ [compiler
+ ["." version]
+ ["." language #_
+ ["#/." lux #_
+ ["#" version]]]]]
+ [world
+ ["." console (#+ Console Simulation)]]]
[///
["@." profile]]
{#program
["." /]})
+(exception: #export console-is-closed!)
+
+(structure: simulation
+ (Simulation [Bit Text])
+
+ (def: (on-read [open? state])
+ (if open?
+ (try.from-maybe
+ (do maybe.monad
+ [head (text.nth 0 state)
+ [_ tail] (text.split 1 state)]
+ (wrap [[open? tail] head])))
+ (exception.throw ..console-is-closed! [])))
+ (def: (on-read-line [open? state])
+ (if open?
+ (try.from-maybe
+ (do maybe.monad
+ [[output state] (text.split-with text.new-line state)]
+ (wrap [[open? state] output])))
+ (exception.throw ..console-is-closed! [])))
+ (def: (on-write input [open? state])
+ (if open?
+ (#try.Success [open? (format state input)])
+ (exception.throw ..console-is-closed! [])))
+ (def: (on-close [open? buffer])
+ (if open?
+ (#try.Success [false buffer])
+ (exception.throw ..console-is-closed! []))))
+
+(def: #export echo
+ (-> Text (Console Promise))
+ (|>> [true] (console.mock ..simulation)))
+
(def: #export test
Test
(<| (_.covering /._)
(do random.monad
[profile @profile.random]
(wrap (do promise.monad
- [verdict (do (try.with promise.monad)
- [_ (/.do! profile)]
- (wrap true))]
+ [#let [console (..echo "")]
+ verdict (do (try.with promise.monad)
+ [_ (/.do! console profile)
+ logging (!.use (\ console read-line) [])]
+ (wrap (text\= (version.format language/lux.version)
+ logging)))]
(_.cover' [/.do!]
(try.default false verdict)))))))