diff options
author | Eduardo Julian | 2022-10-21 14:37:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2022-10-21 14:37:09 -0400 |
commit | 74e8954ee269aa5dea39f1e4e3c55e8d387384a8 (patch) | |
tree | 2e29609e1c57a130c5a7851db67426bb9feebcbc /stdlib/source/test | |
parent | 07d346632a6aff8ce2b66b39b818c298de48df5a (diff) |
Clean-up after format change for extensions [part 2]
Diffstat (limited to '')
4 files changed, 45 insertions, 80 deletions
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 201661c8e..3a724d8e5 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis.lux @@ -39,12 +39,9 @@ ["[0]" \\parser] [\\library ["[0]" / (.only) - [// - [phase - ["[0]" extension]] - [/// - ["[0]" phase] - ["[0]" version]]]]] + [//// + ["[0]" phase] + ["[0]" version]]]] ["[0]" / ["[1][0]" complex] ["[1][0]" inference] @@ -393,18 +390,16 @@ (all _.and (_.coverage [/.set_state] (|> (do phase.monad - [pre (extension.read function.identity) + [pre (phase.read function.identity) _ (/.set_state state/1) - post (extension.read function.identity)] + post (phase.read function.identity)] (in (and (same? state/0 pre) (same? state/1 post)))) - (phase.result [extension.#bundle extension.empty - extension.#state state/0]) + (phase.result state/0) (try.else false))) (_.coverage [/.failure] (|> (/.failure expected_error) - (phase.result [extension.#bundle extension.empty - extension.#state state/0]) + (phase.result state/0) (pipe.when {try.#Failure actual_error} (and (text.contains? expected_error actual_error) @@ -414,8 +409,7 @@ false))) (_.coverage [/.except] (|> (/.except <exception> []) - (phase.result [extension.#bundle extension.empty - extension.#state state/0]) + (phase.result state/0) (pipe.when {try.#Failure actual_error} (and (text.contains? (exception.error <exception> []) actual_error) @@ -426,8 +420,7 @@ (_.coverage [/.with_exception] (|> (/.failure expected_error) (/.with_exception <exception> []) - (phase.result [extension.#bundle extension.empty - extension.#state state/0]) + (phase.result state/0) (pipe.when {try.#Failure actual_error} (and (text.contains? expected_error actual_error) @@ -438,8 +431,7 @@ false))) (_.coverage [/.assertion] (and (|> (/.assertion <exception> [] false) - (phase.result [extension.#bundle extension.empty - extension.#state state/0]) + (phase.result state/0) (pipe.when {try.#Failure actual_error} (and (text.contains? (exception.error <exception> []) actual_error) @@ -448,8 +440,7 @@ _ false)) (|> (/.assertion <exception> [] true) - (phase.result [extension.#bundle extension.empty - extension.#state state/0]) + (phase.result state/0) (pipe.when {try.#Success _} true @@ -505,9 +496,8 @@ (_.coverage [/.set_current_module] (|> (do phase.monad [_ (/.set_current_module expected_module)] - (extension.read (|>> (the .#current_module) (maybe.else "")))) - (phase.result [extension.#bundle extension.empty - extension.#state state]) + (phase.read (|>> (the .#current_module) (maybe.else "")))) + (phase.result state) (pipe.when {try.#Success actual} (same? expected_module actual) @@ -515,7 +505,7 @@ _ false))) (_.coverage [/.with_current_module] - (let [current_module (extension.read (|>> (the .#current_module) (maybe.else "")))] + (let [current_module (phase.read (|>> (the .#current_module) (maybe.else "")))] (|> (do phase.monad [_ (/.set_current_module expected_module) pre current_module @@ -525,16 +515,14 @@ (in (and (same? expected_module pre) (same? dummy_module mid) (same? expected_module post)))) - (phase.result [extension.#bundle extension.empty - extension.#state state]) + (phase.result state) (try.else false)))) (_.coverage [/.location /.set_location] (let [expected (/.location expected_file)] (|> (do phase.monad [_ (/.set_location expected)] - (extension.read (the .#location))) - (phase.result [extension.#bundle extension.empty - extension.#state state]) + (phase.read (the .#location))) + (phase.result state) (pipe.when {try.#Success actual} (same? expected actual) @@ -544,7 +532,7 @@ (_.coverage [/.with_location] (let [expected (/.location expected_file) dummy (/.location expected_code) - location (extension.read (the .#location))] + location (phase.read (the .#location))] (|> (do phase.monad [_ (/.set_location expected) pre location @@ -554,16 +542,14 @@ (in (and (same? expected pre) (same? dummy mid) (same? expected post)))) - (phase.result [extension.#bundle extension.empty - extension.#state state]) + (phase.result state) (try.else false)))) (_.coverage [/.source /.set_source_code] (let [expected (/.source expected_file expected_code)] (|> (do phase.monad [_ (/.set_source_code expected)] - (extension.read (the .#source))) - (phase.result [extension.#bundle extension.empty - extension.#state state]) + (phase.read (the .#source))) + (phase.result state) (pipe.when {try.#Success actual} (same? expected actual) @@ -573,7 +559,7 @@ (_.coverage [/.with_source_code] (let [expected (/.source expected_file expected_code) dummy (/.source expected_code expected_file) - source (extension.read (the .#source))] + source (phase.read (the .#source))] (|> (do phase.monad [_ (/.set_source_code expected) pre source @@ -583,8 +569,7 @@ (in (and (same? expected pre) (same? dummy mid) (same? expected post)))) - (phase.result [extension.#bundle extension.empty - extension.#state state]) + (phase.result state) (try.else false)))) ))) @@ -608,7 +593,7 @@ ..test|when) (_.for [/.Operation /.Phase /.Handler /.Bundle] ..test|phase) - (_.for [/.State+] + (_.for [/.State] ..test|state) (_.coverage [/.format] (bit#= (at /.equivalence = left right) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux index 7442e7a3c..007d2e71e 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/analysis/module.lux @@ -25,11 +25,8 @@ [\\library ["[0]" / (.only) ["/[1]" // (.only) - [// - [phase - ["[2][0]" extension]] - [/// - ["[2][0]" phase]]]]]]) + [//// + ["[2][0]" phase]]]]]) (def random_state (Random Lux) @@ -61,9 +58,7 @@ (def test|module Test (do [! random.monad] - [lux ..random_state - .let [state [/extension.#bundle /extension.empty - /extension.#state lux]] + [state ..random_state name (random.lower_case 1) hash random.nat expected_import (random.lower_case 2) @@ -74,7 +69,7 @@ (_.coverage [/.create] (|> (do /phase.monad [_ (/.create hash name)] - (/extension.lifted (meta.module name))) + (meta.module name)) (/phase.result state) (try#each (..new? hash)) (try.else false))) @@ -103,8 +98,7 @@ [_ (if <expected> (/.import expected_import) (in []))] - (/extension.lifted - (meta.imported? expected_import))))] + (meta.imported? expected_import)))] (in ?)) (/phase.result state) (try#each (bit#= <expected>)) @@ -135,9 +129,7 @@ (def test|state Test (do [! random.monad] - [lux ..random_state - .let [state [/extension.#bundle /extension.empty - /extension.#state lux]] + [state ..random_state name (random.lower_case 1) hash random.nat] (`` (all _.and @@ -200,9 +192,7 @@ (def test|definition Test (do [! random.monad] - [lux ..random_state - .let [state [/extension.#bundle /extension.empty - /extension.#state lux]] + [state ..random_state module_name (random.lower_case 1) hash random.nat def_name (random.lower_case 2) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux index e884cd858..c9953642d 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/extension.lux @@ -71,14 +71,6 @@ (phase.result [/.#bundle /.empty /.#state state]) (try.else false))) - (_.coverage [/.with_state] - (|> (is (/.Operation Int Nat Nat Text) - (/.with_state state - (/.read %.int))) - (at phase.functor each (text#= (%.int state))) - (phase.result [/.#bundle /.empty - /.#state dummy]) - (try.else false))) (_.coverage [/.localized] (|> (is (/.Operation Int Nat Nat Text) (do phase.monad diff --git a/stdlib/source/test/lux/meta/extension.lux b/stdlib/source/test/lux/meta/extension.lux index 3675c0d64..cdcf0879d 100644 --- a/stdlib/source/test/lux/meta/extension.lux +++ b/stdlib/source/test/lux/meta/extension.lux @@ -52,7 +52,6 @@ ["[0]" synthesis (.only) ["<[1]>" \\parser]] [phase - ["[0]" extension] [generation (.,, (.for "JVM" (.,, (.these ["[0]" jvm ["[1]/[0]" runtime]])) @@ -69,7 +68,7 @@ (these (for @.python ... TODO: Remove this hack once Jython is no longer being used as the Python interpreter. - (analysis ("dummy dum dum" self phase archive []) + (analysis ("dummy dum dum" phase archive []) (undefined)) (these)) @@ -77,18 +76,18 @@ ... Analysis (def my_analysis Analysis - (analysis (_ self phase archive [pass_through <code>.any]) + (analysis (_ phase archive [pass_through <code>.any]) (phase archive pass_through))) ... Synthesis (def my_synthesis|synthesis Synthesis - (synthesis (_ self phase archive [pass_through <analysis>.any]) + (synthesis (_ phase archive [pass_through <analysis>.any]) (phase archive pass_through))) (def my_synthesis Analysis - (analysis (_ self phase archive [parameters (<>.some <code>.any)]) + (analysis (_ phase archive [parameters (<>.some <code>.any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) @@ -97,12 +96,12 @@ ... Generation (def my_generation|generation Generation - (generation (_ self phase archive [pass_through <synthesis>.any]) + (generation (_ phase archive [pass_through <synthesis>.any]) (phase archive pass_through))) (def my_generation|synthesis Synthesis - (synthesis (_ self phase archive [parameters (<>.some <analysis>.any)]) + (synthesis (_ phase archive [parameters (<>.some <analysis>.any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) @@ -110,7 +109,7 @@ (def my_generation Analysis - (analysis (_ self phase archive [parameters (<>.some <code>.any)]) + (analysis (_ phase archive [parameters (<>.some <code>.any)]) (let [! phase.monad] (|> parameters (monad.each ! (phase archive)) @@ -118,7 +117,7 @@ (def dummy_generation|generation Generation - (generation (_ self phase archive []) + (generation (_ phase archive []) (let [[_ self] (symbol ..dummy_generation)] (at phase.monad in (for @.jvm (jvm.string self) @@ -131,27 +130,26 @@ (def dummy_generation|synthesis Synthesis - (synthesis (_ self phase archive []) + (synthesis (_ phase archive []) (at phase.monad in {synthesis.#Extension (symbol ..dummy_generation|generation) (list)}))) (def dummy_generation Analysis - (analysis (_ self phase archive []) + (analysis (_ phase archive []) (at phase.monad in {analysis.#Extension (symbol ..dummy_generation|synthesis) (list)}))) ... Declaration (def my_declaration Declaration - (declaration (_ self phase archive [expression <code>.any]) + (declaration (_ phase archive [expression <code>.any]) (do [! phase.monad] - [analysis_phase declaration.analysis + [.let [[_ self] (symbol ..my_declaration)] + analysis_phase declaration.analysis expressionA (<| declaration.lifted_analysis (type.expecting .Any) (analysis_phase archive expression)) - lux (<| declaration.lifted_analysis - extension.lifted - meta.compiler_state) + lux (declaration.lifted_analysis meta.compiler_state) synthesis_phase declaration.synthesis expressionS (declaration.lifted_synthesis |