diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/test/test/luxc/common.lux | 172 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/lang/translation/primitive.lux | 55 | ||||
-rw-r--r-- | new-luxc/test/tests.lux | 61 |
3 files changed, 144 insertions, 144 deletions
diff --git a/new-luxc/test/test/luxc/common.lux b/new-luxc/test/test/luxc/common.lux index 44bd85fd9..b181004f7 100644 --- a/new-luxc/test/test/luxc/common.lux +++ b/new-luxc/test/test/luxc/common.lux @@ -1,72 +1,80 @@ (.module: - lux - (lux (control [monad #+ do]) - [io #+ IO] - (data ["e" error]) - [macro] - (macro [code]) - ["//" lang] - (lang ["//." init] - ["//." module] - ["//." synthesis #+ Synthesis])) - (luxc (lang ["&." host] - (translation (jvm [".T_jvm" expression] - [".T_jvm" eval] - [".T_jvm" runtime] - [".T_jvm" statement]) - ## [js] - ## (js [".T_js" expression] - ## [".T_js" eval] - ## [".T_js" runtime] - ## [".T_js" statement]) - ## [lua] - ## (lua [".T_lua" expression] - ## [".T_lua" eval] - ## [".T_lua" runtime] - ## [".T_lua" statement]) - ## [ruby] - ## (ruby [".T_ruby" expression] - ## [".T_ruby" eval] - ## [".T_ruby" runtime] - ## [".T_ruby" statement]) - ## [python] - ## (python [".T_python" expression] - ## [".T_python" eval] - ## [".T_python" runtime] - ## [".T_python" statement]) - ## [r] - ## (r [".T_r" expression] - ## [".T_r" eval] - ## [".T_r" runtime] - ## [".T_r" statement]) - ## [scheme] - ## (scheme [".T_scheme" expression] - ## [".T_scheme" eval] - ## [".T_scheme" runtime] - ## [".T_scheme" statement]) - ## [common-lisp] - ## (common-lisp [".T_common-lisp" expression] - ## [".T_common-lisp" eval] - ## [".T_common-lisp" runtime] - ## [".T_common-lisp" statement]) - ## [php] - ## (php [".T_php" expression] - ## [".T_php" eval] - ## [".T_php" runtime] - ## [".T_php" statement]) - )))) + [lux #* + [control + [monad (#+ do)]] + [io (#+ IO)] + [data + [error (#+ Error)]] + ["." macro + [code]] + ["." language + [compiler + [init] + [analysis + [module]] + [synthesis (#+ Synthesis)]]]] + [luxc + [lang + [translation + ["." jvm + ["._jvm" expression] + ## ["._jvm" eval] + ## ["._jvm" runtime] + ## ["._jvm" statement] + ] + ## [js] + ## (js ["._js" expression] + ## ["._js" eval] + ## ["._js" runtime] + ## ["._js" statement]) + ## [lua] + ## (lua ["._lua" expression] + ## ["._lua" eval] + ## ["._lua" runtime] + ## ["._lua" statement]) + ## [ruby] + ## (ruby ["._ruby" expression] + ## ["._ruby" eval] + ## ["._ruby" runtime] + ## ["._ruby" statement]) + ## [python] + ## (python ["._python" expression] + ## ["._python" eval] + ## ["._python" runtime] + ## ["._python" statement]) + ## [r] + ## (r ["._r" expression] + ## ["._r" eval] + ## ["._r" runtime] + ## ["._r" statement]) + ## [scheme] + ## (scheme ["._scheme" expression] + ## ["._scheme" eval] + ## ["._scheme" runtime] + ## ["._scheme" statement]) + ## [common-lisp] + ## (common-lisp ["._common-lisp" expression] + ## ["._common-lisp" eval] + ## ["._common-lisp" runtime] + ## ["._common-lisp" statement]) + ## [php] + ## (php ["._php" expression] + ## ["._php" eval] + ## ["._php" runtime] + ## ["._php" statement]) + ]]]) -(type: #export Runner (-> Synthesis (e.Error Any))) -(type: #export Definer (-> Ident Synthesis (e.Error Any))) +(type: #export Runner (-> Synthesis (Error Any))) +(type: #export Definer (-> Ident Synthesis (Error Any))) (do-template [<name> <host>] [(def: #export <name> (IO Lux) (do io.Monad<IO> [host <host>] - (wrap (//init.compiler host))))] + (wrap (init.compiler host))))] - [init-jvm &host.init-host] + [init-jvm jvm.init] ## [init-js js.init] ## [init-lua lua.init] ## [init-ruby ruby.init] @@ -85,7 +93,7 @@ [_ translate-runtime sampleO (translate-expression synthesis)] (eval sampleO)) - (//.with-current-module "") + (language.with-current-module "") (macro.run (io.run init))))) (def: (definer translate-runtime translate-expression eval init translate-def) @@ -96,36 +104,36 @@ (|> (do macro.Monad<Meta> [_ translate-runtime valueO (translate-expression synthesis) - _ (//module.with-module +0 module-name + _ (module.with-module +0 module-name (translate-def def-name Any valueO (' {}))) - sampleO (translate-expression (code.symbol [module-name def-name]))] + sampleO (translate-expression (code.identifier [module-name def-name]))] (eval sampleO)) - (//.with-current-module "") + (language.with-current-module "") (macro.run (io.run init))))) -(def: #export run-jvm (runner runtimeT_jvm.translate expressionT_jvm.translate evalT_jvm.eval init-jvm)) -(def: #export def-jvm (definer runtimeT_jvm.translate expressionT_jvm.translate evalT_jvm.eval init-jvm statementT_jvm.translate-def)) +(def: #export run-jvm (runner runtime_jvm.translate expression_jvm.translate eval_jvm.eval init-jvm)) +(def: #export def-jvm (definer runtime_jvm.translate expression_jvm.translate eval_jvm.eval init-jvm statement_jvm.translate-def)) -## (def: #export run-js (runner runtimeT_js.translate expressionT_js.translate evalT_js.eval init-js)) -## (def: #export def-js (definer runtimeT_js.translate expressionT_js.translate evalT_js.eval init-js statementT_js.translate-def)) +## (def: #export run-js (runner runtime_js.translate expression_js.translate eval_js.eval init-js)) +## (def: #export def-js (definer runtime_js.translate expression_js.translate eval_js.eval init-js statement_js.translate-def)) -## (def: #export run-lua (runner runtimeT_lua.translate expressionT_lua.translate evalT_lua.eval init-lua)) -## (def: #export def-lua (definer runtimeT_lua.translate expressionT_lua.translate evalT_lua.eval init-lua statementT_lua.translate-def)) +## (def: #export run-lua (runner runtime_lua.translate expression_lua.translate eval_lua.eval init-lua)) +## (def: #export def-lua (definer runtime_lua.translate expression_lua.translate eval_lua.eval init-lua statement_lua.translate-def)) -## (def: #export run-ruby (runner runtimeT_ruby.translate expressionT_ruby.translate evalT_ruby.eval init-ruby)) -## (def: #export def-ruby (definer runtimeT_ruby.translate expressionT_ruby.translate evalT_ruby.eval init-ruby statementT_ruby.translate-def)) +## (def: #export run-ruby (runner runtime_ruby.translate expression_ruby.translate eval_ruby.eval init-ruby)) +## (def: #export def-ruby (definer runtime_ruby.translate expression_ruby.translate eval_ruby.eval init-ruby statement_ruby.translate-def)) -## (def: #export run-python (runner runtimeT_python.translate expressionT_python.translate evalT_python.eval init-python)) -## (def: #export def-python (definer runtimeT_python.translate expressionT_python.translate evalT_python.eval init-python statementT_python.translate-def)) +## (def: #export run-python (runner runtime_python.translate expression_python.translate eval_python.eval init-python)) +## (def: #export def-python (definer runtime_python.translate expression_python.translate eval_python.eval init-python statement_python.translate-def)) -## (def: #export run-r (runner runtimeT_r.translate expressionT_r.translate evalT_r.eval init-r)) -## (def: #export def-r (definer runtimeT_r.translate expressionT_r.translate evalT_r.eval init-r statementT_r.translate-def)) +## (def: #export run-r (runner runtime_r.translate expression_r.translate eval_r.eval init-r)) +## (def: #export def-r (definer runtime_r.translate expression_r.translate eval_r.eval init-r statement_r.translate-def)) -## (def: #export run-scheme (runner runtimeT_scheme.translate expressionT_scheme.translate evalT_scheme.eval init-scheme)) -## (def: #export def-scheme (definer runtimeT_scheme.translate expressionT_scheme.translate evalT_scheme.eval init-scheme statementT_scheme.translate-def)) +## (def: #export run-scheme (runner runtime_scheme.translate expression_scheme.translate eval_scheme.eval init-scheme)) +## (def: #export def-scheme (definer runtime_scheme.translate expression_scheme.translate eval_scheme.eval init-scheme statement_scheme.translate-def)) -## (def: #export run-common-lisp (runner runtimeT_common-lisp.translate expressionT_common-lisp.translate evalT_common-lisp.eval init-common-lisp)) -## (def: #export def-common-lisp (definer runtimeT_common-lisp.translate expressionT_common-lisp.translate evalT_common-lisp.eval init-common-lisp statementT_common-lisp.translate-def)) +## (def: #export run-common-lisp (runner runtime_common-lisp.translate expression_common-lisp.translate eval_common-lisp.eval init-common-lisp)) +## (def: #export def-common-lisp (definer runtime_common-lisp.translate expression_common-lisp.translate eval_common-lisp.eval init-common-lisp statement_common-lisp.translate-def)) -## (def: #export run-php (runner runtimeT_php.translate expressionT_php.translate evalT_php.eval init-php)) -## (def: #export def-php (definer runtimeT_php.translate expressionT_php.translate evalT_php.eval init-php statementT_php.translate-def)) +## (def: #export run-php (runner runtime_php.translate expression_php.translate eval_php.eval init-php)) +## (def: #export def-php (definer runtime_php.translate expression_php.translate eval_php.eval init-php statement_php.translate-def)) diff --git a/new-luxc/test/test/luxc/lang/translation/primitive.lux b/new-luxc/test/test/luxc/lang/translation/primitive.lux index 14a887873..1c4236913 100644 --- a/new-luxc/test/test/luxc/lang/translation/primitive.lux +++ b/new-luxc/test/test/luxc/lang/translation/primitive.lux @@ -1,42 +1,47 @@ (.module: - lux - (lux [io #+ IO] - (control [monad #+ do] - pipe) - (data text/format - ["e" error] - [bit "bit/" Eq<Bit>] - [text "text/" Eq<Text>]) - ["r" math/random] - (lang ["//." synthesis]) - test) - (luxc (lang [".L" host])) - (test/luxc common)) + [lux #* + [control + [monad (#+ do)] + pipe] + [data + [error] + [bit ("bit/" Equivalence<Bit>)] + [text ("text/" Equivalence<Text>) + format]] + [math + ["r" random]] + [language + [compiler + [synthesis]]] + test] + [test + [luxc + common]]) (def: (spec run) (-> Runner Test) (do r.Monad<Random> - [%bit% r.bit - %nat% r.nat - %int% r.int - %rev% r.rev - %frac% r.frac - %text% (r.ascii +5)] + [|bit| r.bit + |nat| r.nat + |int| r.int + |rev| r.rev + |frac| r.frac + |text| (r.ascii +5)] (`` ($_ seq (~~ (do-template [<desc> <type> <synthesis> <sample> <test>] [(test (format "Can translate " <desc> ".") (|> (run (<synthesis> <sample>)) - (case> (#e.Success valueT) + (case> (#error.Success valueT) (<test> <sample> (:coerce <type> valueT)) - (#e.Error error) + (#error.Error error) (exec (log! error) #0))))] - ["bit" Bit //synthesis.bit %bit% bit/=] - ["int" Int //synthesis.i64 %int% i/=] - ["frac" Frac //synthesis.f64 %frac% f/=] - ["text" Text //synthesis.text %text% text/=])) + ["bit" Bit synthesis.bit |bit| bit/=] + ["int" Int synthesis.i64 |int| i/=] + ["frac" Frac synthesis.f64 |frac| f/=] + ["text" Text synthesis.text |text| text/=])) )))) (context: "[JVM] Primitives." diff --git a/new-luxc/test/tests.lux b/new-luxc/test/tests.lux index b6e6f3ca8..09b95c6b2 100644 --- a/new-luxc/test/tests.lux +++ b/new-luxc/test/tests.lux @@ -1,41 +1,28 @@ (.module: - lux - (lux (control monad) - [io] - (concurrency [promise]) - [cli #+ program:] - [test]) - (test (luxc (lang (analysis ["_.A" primitive] - ["_.A" structure] - ["_.A" reference] - ["_.A" case] - ["_.A" function] - ["_.A" type] - (procedure ["_.A" common] - ["_.A" host])) - (synthesis ["_.S" primitive] - ["_.S" structure] - (case ["_.S" special]) - ["_.S" function] - ["_.S" procedure] - ["_.S" loop]) - (translation ["_.T" primitive] - ["_.T" structure] - ["_.T" function] - ["_.T" reference] - ["_.T" case] - ["_.T" common] - ["_.T" jvm] - ## ["_.T" js] - ## ["_.T" lua] - ## ["_.T" ruby] - ## ["_.T" python] - ## ["_.T" r] - ## ["_.T" scheme] - ## ["_.T" common-lisp] - ## ["_.T" php] - )) - ))) + [lux + [cli (#+ program:)] + [test]] + [test + [luxc + [lang + [translation + ["_.T" primitive] + ## ["_.T" structure] + ## ["_.T" function] + ## ["_.T" reference] + ## ["_.T" case] + ## ["_.T" common] + ## ["_.T" jvm] + ## ["_.T" js] + ## ["_.T" lua] + ## ["_.T" ruby] + ## ["_.T" python] + ## ["_.T" r] + ## ["_.T" scheme] + ## ["_.T" common-lisp] + ## ["_.T" php] + ]]]] + ) (program: args (test.run)) |