diff options
author | Eduardo Julian | 2017-05-17 20:23:02 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-17 20:23:02 -0400 |
commit | 8bd1d1b3a4750b26f1540717839c1aa196f2a520 (patch) | |
tree | cc9d595998c3bf4d15e434480f5505fd491e39b0 /stdlib/test | |
parent | 824482b2e8b13e42a524a5e4945ea3e172395c9e (diff) |
- Renamed "Error" to "Result".
Diffstat (limited to 'stdlib/test')
-rw-r--r-- | stdlib/test/test/lux/concurrency/actor.lux | 2 | ||||
-rw-r--r-- | stdlib/test/test/lux/concurrency/frp.lux | 3 | ||||
-rw-r--r-- | stdlib/test/test/lux/concurrency/promise.lux | 3 | ||||
-rw-r--r-- | stdlib/test/test/lux/control/exception.lux | 4 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/format/json.lux | 2 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/result.lux (renamed from stdlib/test/test/lux/data/error.lux) | 20 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/text/lexer.lux | 12 | ||||
-rw-r--r-- | stdlib/test/test/lux/data/text/regex.lux | 3 | ||||
-rw-r--r-- | stdlib/test/test/lux/macro/syntax.lux | 4 | ||||
-rw-r--r-- | stdlib/test/tests.lux | 2 |
10 files changed, 26 insertions, 29 deletions
diff --git a/stdlib/test/test/lux/concurrency/actor.lux b/stdlib/test/test/lux/concurrency/actor.lux index a4c69a880..a92c2c376 100644 --- a/stdlib/test/test/lux/concurrency/actor.lux +++ b/stdlib/test/test/lux/concurrency/actor.lux @@ -4,7 +4,7 @@ (control monad) (data [number] text/format - [error #- fail]) + ["R" result]) (concurrency [promise #+ Promise Monad<Promise> "Promise/" Monad<Promise>] ["&" actor #+ actor:])) lux/test) diff --git a/stdlib/test/test/lux/concurrency/frp.lux b/stdlib/test/test/lux/concurrency/frp.lux index a141753a8..245428f38 100644 --- a/stdlib/test/test/lux/concurrency/frp.lux +++ b/stdlib/test/test/lux/concurrency/frp.lux @@ -3,8 +3,7 @@ (lux [io #- run] (control monad) (data [number] - text/format - [error #- fail]) + text/format) (concurrency [promise #+ Promise Monad<Promise> "Promise/" Monad<Promise>] ["&" frp])) lux/test) diff --git a/stdlib/test/test/lux/concurrency/promise.lux b/stdlib/test/test/lux/concurrency/promise.lux index 7ad25fc46..8c4e623e4 100644 --- a/stdlib/test/test/lux/concurrency/promise.lux +++ b/stdlib/test/test/lux/concurrency/promise.lux @@ -4,8 +4,7 @@ (control monad pipe) (data [number] - text/format - [error #- fail]) + text/format) (concurrency ["&" promise]) ["R" math/random]) lux/test) diff --git a/stdlib/test/test/lux/control/exception.lux b/stdlib/test/test/lux/control/exception.lux index 80267cedd..bef3ae4cd 100644 --- a/stdlib/test/test/lux/control/exception.lux +++ b/stdlib/test/test/lux/control/exception.lux @@ -3,7 +3,7 @@ (lux [io] (control monad ["&" exception #+ exception:]) - (data [error #- fail] + (data ["E" result] [text] text/format [number]) @@ -36,7 +36,7 @@ another-val) otherwise-val) default-val) - actual (|> (: (Error Nat) + actual (|> (: (E;Result Nat) (if should-throw? (&;throw this-ex "Uh-oh...") (&;return default-val))) diff --git a/stdlib/test/test/lux/data/format/json.lux b/stdlib/test/test/lux/data/format/json.lux index 7acddf750..b52b72635 100644 --- a/stdlib/test/test/lux/data/format/json.lux +++ b/stdlib/test/test/lux/data/format/json.lux @@ -7,7 +7,7 @@ pipe) (data [text "Text/" Monoid<Text>] text/format - [error #- fail] + [result] [bool] [char] [maybe] diff --git a/stdlib/test/test/lux/data/error.lux b/stdlib/test/test/lux/data/result.lux index d90387c89..aee931279 100644 --- a/stdlib/test/test/lux/data/error.lux +++ b/stdlib/test/test/lux/data/result.lux @@ -4,18 +4,18 @@ (control monad pipe) (data text/format - ["&" error])) + ["&" result])) lux/test) -(test: "Errors" - (let [(^open "&/") &;Monad<Error>] +(test: "Results" + (let [(^open "&/") &;Monad<Result>] ($_ seq (assert "Functor correctly handles both cases." - (and (|> (: (&;Error Int) (#&;Success 10)) + (and (|> (: (&;Result Int) (#&;Success 10)) (&/map i.inc) (case> (#&;Success 11) true _ false)) - (|> (: (&;Error Int) (#&;Error "YOLO")) + (|> (: (&;Result Int) (#&;Error "YOLO")) (&/map i.inc) (case> (#&;Error "YOLO") true _ false)) )) @@ -29,13 +29,13 @@ (case> (#&;Error "YOLO") true _ false)))) (assert "Monad correctly handles both cases." - (and (|> (do &;Monad<Error> + (and (|> (do &;Monad<Result> [f (wrap i.+) a (wrap 10) b (wrap 20)] (wrap (f a b))) (case> (#&;Success 30) true _ false)) - (|> (do &;Monad<Error> + (|> (do &;Monad<Result> [f (wrap i.+) a (#&;Error "YOLO") b (wrap 20)] @@ -45,10 +45,10 @@ ))) (test: "Monad transformer" - (let [lift (&;lift-error io;Monad<IO>) + (let [lift (&;lift-result io;Monad<IO>) (^open "io/") io;Monad<IO>] - (assert "Can add error functionality to any monad." - (|> (io;run (do (&;ErrorT io;Monad<IO>) + (assert "Can add result functionality to any monad." + (|> (io;run (do (&;ResultT io;Monad<IO>) [a (lift (io/wrap 123)) b (wrap 456)] (wrap (i.+ a b)))) diff --git a/stdlib/test/test/lux/data/text/lexer.lux b/stdlib/test/test/lux/data/text/lexer.lux index 8a63cf573..f9b6bdc79 100644 --- a/stdlib/test/test/lux/data/text/lexer.lux +++ b/stdlib/test/test/lux/data/text/lexer.lux @@ -3,7 +3,7 @@ (lux (control monad pipe) [io] - (data [error #- fail] + (data ["E" result] [text "T/" Eq<Text>] text/format ["&" text/lexer] @@ -14,13 +14,13 @@ ## [Utils] (def: (should-fail input) - (All [a] (-> (Error a) Bool)) + (All [a] (-> (E;Result a) Bool)) (case input (#;Left _) true _ false)) (def: (should-passC test input) - (-> Char (Error Char) Bool) + (-> Char (E;Result Char) Bool) (case input (#;Right output) (C/= test output) @@ -29,7 +29,7 @@ false)) (def: (should-passT test input) - (-> Text (Error Text) Bool) + (-> Text (E;Result Text) Bool) (case input (#;Right output) (T/= test output) @@ -38,7 +38,7 @@ false)) (def: (should-passL test input) - (-> (List Char) (Error (List Char)) Bool) + (-> (List Char) (E;Result (List Char)) Bool) (let [(^open "L/") (list;Eq<List> char;Eq<Char>)] (case input (#;Right output) @@ -48,7 +48,7 @@ false))) (def: (should-passE test input) - (-> (Either Char Char) (Error (Either Char Char)) Bool) + (-> (Either Char Char) (E;Result (Either Char Char)) Bool) (case input (#;Right output) (case [test output] diff --git a/stdlib/test/test/lux/data/text/regex.lux b/stdlib/test/test/lux/data/text/regex.lux index 62953b20b..e4cfa2e10 100644 --- a/stdlib/test/test/lux/data/text/regex.lux +++ b/stdlib/test/test/lux/data/text/regex.lux @@ -3,8 +3,7 @@ (lux [io] (control monad pipe) - (data [error #- fail] - [product] + (data [product] [text "T/" Eq<Text>] text/format (text [lexer] diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index f75a7117e..0badc67f3 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -9,7 +9,7 @@ [bool] [char] [ident] - [error #- fail]) + ["E" result]) ["R" math/random] [macro] (macro [code] @@ -45,7 +45,7 @@ false)) (def: (fails? input) - (All [a] (-> (Error a) Bool)) + (All [a] (-> (E;Result a) Bool)) (case input (#;Left _) true diff --git a/stdlib/test/tests.lux b/stdlib/test/tests.lux index b3eaeb22c..b55373330 100644 --- a/stdlib/test/tests.lux +++ b/stdlib/test/tests.lux @@ -25,7 +25,7 @@ (data ["_;" bit] ["_;" bool] ["_;" char] - ["_;" error] + ["_;" result] ["_;" ident] ["_;" identity] ["_;" log] |