From b7873d4b68ffc041f9ff134c52a32b54c20febf9 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 9 Jan 2022 05:35:12 -0400 Subject: Fixed a bug when testing extensions on the JVM compiler. --- stdlib/source/test/lux/extension.lux | 53 +++++++++++++------- stdlib/source/test/lux/tool.lux | 4 ++ .../compiler/language/lux/analysis/primitive.lux | 1 + .../lux/tool/compiler/meta/archive/signature.lux | 56 ++++++++++++++++++++++ 4 files changed, 96 insertions(+), 18 deletions(-) create mode 100644 stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index a754e9bd2..a48460778 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -3,28 +3,35 @@ [lux "*" ["[0]" debug] ["@" target - ["[0]" jvm] ["[0]" js] ["[0]" python] ["[0]" lua] ["[0]" ruby] ["[0]" php] - ["[0]" scheme]] + ["[0]" scheme] + ["[0]" jvm + ["[0]" class] + ["[0]" version] + [encoding + ["[0]" name]]]] [abstract ["[0]" monad {"+" do}]] [control - ["[0]" try] + ["[0]" try ("[1]#[0]" functor)] ["<>" parser ["<[0]>" code] ["<[0]>" analysis] ["<[0]>" synthesis]]] [data + ["[0]" binary] ["[0]" product] ["[0]" text ("[1]#[0]" equivalence) ["%" format {"+" format}]] [collection ["[0]" sequence] - ["[0]" list ("[1]#[0]" functor)]]] + ["[0]" list ("[1]#[0]" functor)]] + [format + ["[0]F" binary]]] [macro ["[0]" template]] [math @@ -45,7 +52,10 @@ ["[0]" directive] [phase [analysis - ["[0]" type]]]]]]] + ["[0]" type]] + [generation + ["[0]" jvm "_" + ["[1]/[0]" runtime]]]]]]]] ["_" test {"+" Test}]]] [\\library ["[0]" / {"+" analysis: synthesis: generation: directive:}]]) @@ -146,19 +156,26 @@ (do ! [[module_id artifact_id] (generation.context archive) .let [commentary (format "Successfully installed directive " (%.text self) "!")] - _ (for [@.jvm (in []) - @.js (generation.save! artifact_id {.#None} - (js.comment commentary - (js.statement (js.string commentary)))) - @.python (generation.save! artifact_id {.#None} - (python.comment commentary - (python.statement (python.string commentary)))) - @.lua (generation.save! artifact_id {.#None} - (lua.comment commentary - (lua.statement (lua.string commentary)))) - @.ruby (generation.save! artifact_id {.#None} - (ruby.comment commentary - (ruby.statement (ruby.string commentary))))])] + _ (generation.save! artifact_id {.#None} + (for [@.jvm (let [$class (jvm/runtime.class_name [module_id artifact_id])] + (<| [$class] + (try.else (binary.empty 0)) + (try#each (binaryF.result class.writer)) + (class.class version.v6_0 class.public + (name.internal $class) + (name.internal "java.lang.Object") + (list) + (list) + (list) + sequence.empty))) + @.js (js.comment commentary + (js.statement (js.string commentary))) + @.python (python.comment commentary + (python.statement (python.string commentary))) + @.lua (lua.comment commentary + (lua.statement (lua.string commentary))) + @.ruby (ruby.comment commentary + (ruby.statement (ruby.string commentary)))]))] (generation.log! commentary))))] (in directive.no_requirements))) diff --git a/stdlib/source/test/lux/tool.lux b/stdlib/source/test/lux/tool.lux index 4e3bad586..df128f232 100644 --- a/stdlib/source/test/lux/tool.lux +++ b/stdlib/source/test/lux/tool.lux @@ -17,6 +17,9 @@ ... ["[1][0]" analysis] ... ["[1][0]" synthesis]] ]] + ["[1][0]" meta "_" + ["[1]/[0]" archive "_" + ["[1]/[0]" signature]]] ]]) (def: .public test @@ -27,6 +30,7 @@ /reference.test /analysis/primitive.test /analysis/composite.test + /meta/archive/signature.test ... /syntax.test ... /analysis.test ... /synthesis.test diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/primitive.lux b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/primitive.lux index 4d67a47f9..3c88cd1e5 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/analysis/primitive.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/analysis/primitive.lux @@ -35,6 +35,7 @@ ($_ _.and (_.for [/.equivalence] ($equivalence.spec /.equivalence ..random)) + (do random.monad [left ..random right ..random] diff --git a/stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux b/stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux new file mode 100644 index 000000000..948329ada --- /dev/null +++ b/stdlib/source/test/lux/tool/compiler/meta/archive/signature.lux @@ -0,0 +1,56 @@ +(.using + [library + [lux "*" + ["_" test {"+" Test}] + [abstract + [monad {"+" do}] + [\\specification + ["$[0]" equivalence]]] + [control + ["[0]" try ("[1]#[0]" functor)] + [parser + ["<[0]>" binary]]] + [data + ["[0]" bit ("[1]#[0]" equivalence)] + ["[0]" text ("[1]#[0]" equivalence)] + [format + ["[0]F" binary]]] + [math + ["[0]" random {"+" Random}]]]] + [\\library + ["[0]" /]] + ["[0]" //// "_" + ["[1][0]" version]]) + +(def: .public random + (Random /.Signature) + ($_ random.and + ($_ random.and + (random.ascii/upper 5) + (random.ascii/lower 5)) + ////version.random + )) + +(def: .public test + Test + (<| (_.covering /._) + (_.for [/.Signature]) + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + + (do random.monad + [left ..random + right ..random] + (_.cover [/.description] + (bit#= (# /.equivalence = left right) + (text#= (/.description left) (/.description right))))) + (do random.monad + [expected ..random] + (_.cover [/.writer /.parser] + (|> expected + (binaryF.result /.writer) + (.result /.parser) + (try#each (# /.equivalence = expected)) + (try.else false)))) + ))) -- cgit v1.2.3