diff options
author | Eduardo Julian | 2020-11-04 04:04:49 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-11-04 04:04:49 -0400 |
commit | 8ac980fd3b6d2050edc0e631a00028c1e6c28c73 (patch) | |
tree | ae1efc0f0859489b05e57f9c236b7b2c12a91b93 /stdlib/source/test/lux/world | |
parent | fd3152f29c8d8e9cc134423da18fb828ba20ebcc (diff) |
Re-named "lux/control/concurrency/process" to "thread".
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r-- | stdlib/source/test/lux/world/shell.lux | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux new file mode 100644 index 000000000..f98fc6a17 --- /dev/null +++ b/stdlib/source/test/lux/world/shell.lux @@ -0,0 +1,58 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + [monad (#+ do)]] + [control + ["." try (#+ Try)] + ["." exception (#+ exception:)]] + [data + [number + ["n" nat] + ["i" int]] + [collection + ["." list]]]] + {1 + ["." /]} + {[1 #spec] + ["$." /]}) + +(exception: dead) + +(def: (simulation [environment command arguments]) + (-> [/.Environment /.Command (List /.Argument)] + (/.Simulation Bit)) + (structure + (def: (on-read dead?) + (if dead? + (exception.throw ..dead []) + (do try.monad + [to-echo (try.from-maybe (list.head arguments))] + (wrap [dead? to-echo])))) + + (def: (on-error dead?) + (if dead? + (exception.throw ..dead []) + (exception.return [dead? ""]))) + + (def: (on-write message dead?) + (if dead? + (exception.throw ..dead []) + (#try.Success dead?))) + + (def: (on-destroy dead?) + (if dead? + (exception.throw ..dead []) + (#try.Success true))) + + (def: (on-await dead?) + (if dead? + (exception.throw ..dead []) + (#try.Success [true /.normal]))))) + +(def: #export test + Test + (<| (_.covering /._) + (_.with-cover [/.mock /.Simulation] + ($/.spec (/.mock (|>> ..simulation #try.Success) + false))))) |