diff options
author | Eduardo Julian | 2022-08-11 16:50:42 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-08-11 16:50:42 -0400 |
commit | e5625dd840a8b8adc76987f649da254335d3d93a (patch) | |
tree | fb672669383525d90d462edf8c141f98bc953894 /stdlib/source/test | |
parent | 065e8a4d8122d4616b570496915d2c0e2c78cd6b (diff) |
Improved exception-definition macro.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/aedifex/command/version.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/repository.lux | 14 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/concurrency/actor.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/exception.lux | 9 | ||||
-rw-r--r-- | stdlib/source/test/lux/control/region.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/compiler/phase.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/macro/syntax/export.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/meta/type/check.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/console.lux | 4 | ||||
-rw-r--r-- | stdlib/source/test/lux/world/shell.lux | 4 |
11 files changed, 31 insertions, 28 deletions
diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index 7d2877738..169b20ef6 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -6,7 +6,7 @@ [control ["[0]" maybe] ["[0]" try] - ["[0]" exception (.only exception)] + ["[0]" exception] [concurrency ["[0]" async (.only Async)]]] [data @@ -28,7 +28,7 @@ [\\program ["[0]" /]]) -(exception .public console_is_closed!) +(exception.def .public console_is_closed!) (def mock (Mock [Bit Text]) diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index fbb3ef01b..fd26f3898 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -43,13 +43,15 @@ (-> Version Artifact) (|>> ["com.github.luxlang" "test-artifact"])) -(exception (not_found [uri URI]) - (exception.report - (list ["URI" (%.text uri)]))) +(with_template [<name>] + [(exception.def (<name> uri) + (Exception URI) + (exception.report + (list ["URI" (%.text uri)])))] -(exception (cannot_upload [uri URI]) - (exception.report - (list ["URI" (%.text uri)]))) + [not_found] + [cannot_upload] + ) (type Store (Dictionary URI Binary)) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index d11016a4b..e8d3568fd 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -5,7 +5,7 @@ [monad (.only do)]] [control ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] + ["[0]" exception] ["[0]" io (.only IO io)]] [data [text @@ -27,7 +27,7 @@ ["[0]" async (.only Async Resolver) (.use "[1]#[0]" monad)] ["[0]" frp]]]]) -(exception got_wrecked) +(exception.def got_wrecked) (def counter (/.Behavior Nat) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index d90494bd9..5c29d3103 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -17,11 +17,12 @@ [// ["[0]" try (.only Try)]]]]) -(/.exception an_exception) -(/.exception another_exception) +(/.def an_exception) +(/.def another_exception) (def label "YOLO") -(/.exception (custom_exception [value Nat]) +(/.def (custom_exception value) + (/.Exception Nat) (/.report (list [label (%.nat value)]))) (def .public test @@ -104,7 +105,7 @@ {try.#Failure message} (and (text.contains? (/.error ..an_exception []) message) (text.contains? (/.error ..another_exception []) message))))) - (_.coverage [/.exception] + (_.coverage [/.def] (when (/.except ..custom_exception [expected]) {try.#Success _} false diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 54e22f811..a859fd904 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -28,9 +28,9 @@ ["[0]" / (.only Region) [// ["[0]" thread (.only Thread)] - ["[0]" exception (.only Exception exception)]]]]) + ["[0]" exception (.only Exception)]]]]) -(exception oops) +(exception.def oops) (def (success? result) (All (_ a) (-> (Try a) Bit)) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux index 69e3885f8..201661c8e 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux @@ -9,7 +9,7 @@ ["<>" parser] ["[0]" pipe] ["[0]" try] - ["[0]" exception (.only exception)] + ["[0]" exception] ["[0]" function] ["[0]" maybe]] [data @@ -373,7 +373,7 @@ (with_expansions [<id> (static.random_nat) <exception> (template.symbol ["exception_" <id>])] - (exception <exception>) + (exception.def <exception>) (def test|phase Test diff --git a/stdlib/source/test/lux/meta/compiler/phase.lux b/stdlib/source/test/lux/meta/compiler/phase.lux index 18cad7805..cc82568de 100644 --- a/stdlib/source/test/lux/meta/compiler/phase.lux +++ b/stdlib/source/test/lux/meta/compiler/phase.lux @@ -9,7 +9,7 @@ [control ["[0]" pipe] ["[0]" try (.use "[1]#[0]" functor)] - ["[0]" exception (.only exception)]] + ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] @@ -43,7 +43,7 @@ _ false))) -(exception oops) +(exception.def oops) (def test|error Test diff --git a/stdlib/source/test/lux/meta/macro/syntax/export.lux b/stdlib/source/test/lux/meta/macro/syntax/export.lux index e074f64ae..68a999ad5 100644 --- a/stdlib/source/test/lux/meta/macro/syntax/export.lux +++ b/stdlib/source/test/lux/meta/macro/syntax/export.lux @@ -31,7 +31,7 @@ (<| (_.covering /._) (do random.monad [[expected_export_policy expected_un_exported] ..export] - (_.coverage [/.parser /.default_policy] + (_.coverage [/.parser /.default] (|> (when expected_export_policy {.#Some expected_export_policy} (list expected_export_policy (code.nat expected_un_exported)) @@ -41,7 +41,7 @@ (<code>.result (/.parser <code>.nat)) (try#each (function (_ [actual_export_policy actual_un_exported]) (|> expected_export_policy - (maybe.else /.default_policy) + (maybe.else /.default) (code#= actual_export_policy) (and (n.= expected_un_exported actual_un_exported))))) (try.else false)))))) diff --git a/stdlib/source/test/lux/meta/type/check.lux b/stdlib/source/test/lux/meta/type/check.lux index b6459169f..441070482 100644 --- a/stdlib/source/test/lux/meta/type/check.lux +++ b/stdlib/source/test/lux/meta/type/check.lux @@ -11,7 +11,7 @@ ["[0]" pipe] ["[0]" function] ["[0]" try] - ["[0]" exception (.only exception)]] + ["[0]" exception]] [data ["[0]" bit (.use "[1]#[0]" equivalence)] ["[0]" product] @@ -129,7 +129,7 @@ (Random Type) (primitive_type 2)) -(exception yolo) +(exception.def yolo) (def error_handling Test diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index 1cac08a06..e4d595dec 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -6,7 +6,7 @@ [control ["[0]" io] ["[0]" try (.only Try)] - ["[0]" exception (.only exception)]] + ["[0]" exception]] [data ["[0]" text (.use "[1]#[0]" equivalence) ["%" \\format (.only format)]]] @@ -19,7 +19,7 @@ [\\specification ["$[0]" /]]) -(exception dead) +(exception.def dead) (def mock (/.Mock [Bit Text]) diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index ce6b1b984..32e2d3494 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -5,7 +5,7 @@ [monad (.only do)]] [control ["[0]" try (.only Try)] - ["[0]" exception (.only exception)] + ["[0]" exception] ["[0]" io (.only IO)] [concurrency ["[0]" async (.only Async)]]] @@ -30,7 +30,7 @@ [\\specification ["$[0]" /]]) -(exception dead) +(exception.def dead) (def (mock [environment working_directory command arguments]) (-> [Environment Path /.Command (List /.Argument)] |