diff options
author | Eduardo Julian | 2021-01-12 23:09:05 -0400 |
---|---|---|
committer | Eduardo Julian | 2021-01-12 23:09:05 -0400 |
commit | 71de092a045dc70ab1c9eead477cf1512b144a87 (patch) | |
tree | 1f71aca655d867b748c430996d3687911b7537cc /stdlib/source/test/lux/world | |
parent | 5dbf134346424602b0104d1f749c1a9eac6f21af (diff) |
Raise error when trying to use deprecated fields/method/classes in JVM.
Diffstat (limited to 'stdlib/source/test/lux/world')
-rw-r--r-- | stdlib/source/test/lux/world/console.lux | 59 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/shell.lux | 8 |
2 files changed, 47 insertions, 20 deletions
diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index b7c7d3a50..6c71f913c 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -6,7 +6,14 @@ [control ["." io] ["." try (#+ Try)] - ["." exception (#+ exception:)]]] + ["." exception (#+ exception:)] + [security + ["!" capability]]] + [data + ["." text ("#\." equivalence) + ["%" format (#+ format)]]] + [math + ["." random]]] {1 ["." /]} {[1 #spec] @@ -15,30 +22,50 @@ (exception: dead) (def: simulation - (/.Simulation Bit) + (/.Simulation [Bit Text]) (structure - (def: (on_read dead?) - (if dead? - (exception.throw ..dead []) - (#try.Success [dead? (char "a")]))) + (def: (on_read [dead? content]) + (do try.monad + [char (try.from_maybe (text.nth 0 content)) + [_ content] (try.from_maybe (text.split 1 content))] + (if dead? + (exception.throw ..dead []) + (wrap [[dead? content] char])))) - (def: (on_read_line dead?) - (if dead? - (exception.throw ..dead []) - (#try.Success [dead? "YOLO"]))) + (def: (on_read_line [dead? content]) + (do try.monad + [[line content] (try.from_maybe (text.split_with text.new_line content))] + (if dead? + (exception.throw ..dead []) + (wrap [[dead? content] line])))) - (def: (on_write message dead?) + (def: (on_write message [dead? content]) (if dead? (exception.throw ..dead []) - (#try.Success dead?))) + (#try.Success [dead? (format content message)]))) - (def: (on_close dead?) + (def: (on_close [dead? content]) (if dead? (exception.throw ..dead []) - (#try.Success true))))) + (#try.Success [true content]))))) (def: #export test Test (<| (_.covering /._) - (_.for [/.mock /.Simulation] - ($/.spec (io.io (/.mock ..simulation false)))))) + ($_ _.and + (_.for [/.async /.mock /.Simulation] + ($/.spec (io.io (/.async (/.mock ..simulation [false ""]))))) + (do random.monad + [expected (random.ascii/alpha 10) + #let [console (/.mock ..simulation [false ""])]] + (_.cover [/.write_line] + (io.run + (do io.monad + [?_ (/.write_line expected console) + ?actual (!.use (\ console read_line) [])] + (wrap (<| (try.default false) + (do try.monad + [_ ?_ + actual ?actual] + (wrap (text\= expected actual))))))))) + ))) diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index a336de350..fa7d77f22 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -98,9 +98,9 @@ Test (<| (_.covering /._) ($_ _.and - (_.for [/.mock /.Simulation] - ($/.spec (/.mock (|>> ..simulation #try.Success) - false))) + (_.for [/.async /.mock /.Simulation] + ($/.spec (/.async (/.mock (|>> ..simulation #try.Success) + false)))) (_.cover [/.error] (not (i.= /.normal /.error))) (do random.monad @@ -137,6 +137,6 @@ wrote! destroyed! (i.= exit await))))] - (_.cover' [/.async /.Can_Write] + (_.cover' [/.Can_Write] (try.default false verdict))))) ))) |