diff options
author | Eduardo Julian | 2023-01-26 02:39:27 -0400 |
---|---|---|
committer | Eduardo Julian | 2023-01-26 02:39:27 -0400 |
commit | f391f448f4fe6508502a68aa1c51d60475967952 (patch) | |
tree | 0ebfaee3aee8d2083e20917157eb8dab6c2f47c3 /stdlib/source/test | |
parent | 70aa7154e64c0ab2352c00e5f993e88737929ccc (diff) |
Optimized Tar parsing in order to fix stack-overflow when loading cache.
Diffstat (limited to 'stdlib/source/test')
7 files changed, 157 insertions, 67 deletions
diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index d0620d344..64ac888ac 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -1120,7 +1120,11 @@ (def for_meta Test (all _.and - (_.coverage [/.Mode /.Info] + (_.coverage [/.Info + /.#target /.#version /.#mode /.#configuration + + /.Mode + /.#Build /.#Eval /.#Interpreter] (for_meta|Info)) (_.coverage [/.Module_State /.#Active /.#Compiled /.#Cached] diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index b13f9097c..2fdf791c4 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -50,10 +50,7 @@ ["[1][0]" static] ["[1][0]" extension] ["[1][0]" global] - ["[1][0]" compiler - ... ["[1]/[0]" phase] - ] - ]) + ["[1][0]" compiler]]) (def !expect (template (_ <pattern> <value>) @@ -1052,6 +1049,5 @@ (,, (for @.old (,, (these)) (,, (these /extension.test)))) /global.test - /compiler.test ))))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux index 35e683c48..c3b774b5e 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux @@ -1,44 +1,52 @@ ... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. ... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -(.require - [library - [lux (.except) - [abstract - ["[0]" monad (.only do) - ["[1]T" \\test]] - ["[0]" functor - ["[1]T" \\test (.only Injection Comparison)]]] - [control - ["[0]" pipe] - ["[0]" try (.use "[1]#[0]" functor)] - ["[0]" exception]] - [data - ["[0]" text (.use "[1]#[0]" equivalence) - ["%" \\format (.only format)]]] - [math - ["[0]" random] - [number - ["n" nat] - ["i" int]]] - [test - ["_" property (.only Test)]]]] - [\\library - ["[0]" / (.only) - [//// - [meta - ["[0]" archive]]]]] - ["[0]" / - ["[1][0]" translation - ["[1]/[0]" jvm - ["[1]/[0]" host] - ["[1]/[0]" primitive] - ["[1]/[0]" type] - ["[1]/[0]" value] - ["[1]/[0]" runtime] - ["[1]/[0]" complex] - ["[1]/[0]" function] - ["[1]/[0]" reference]]]]) +(.`` (.`` (.require + [library + [lux (.except) + [abstract + ["[0]" monad (.only do) + ["[1]T" \\test]] + ["[0]" functor + ["[1]T" \\test (.only Injection Comparison)]]] + [control + ["[0]" pipe] + ["[0]" try (.use "[1]#[0]" functor)] + ["[0]" exception]] + [data + ["[0]" text (.use "[1]#[0]" equivalence) + ["%" \\format (.only format)]]] + [math + ["[0]" random] + [number + ["n" nat] + ["i" int]]] + [meta + [compiler + ["@" target]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [//// + [meta + ["[0]" archive]]]]] + [/ + [translation + (.,, (.for "JVM" (.,, (.these ["[0]" jvm + ["[1]/[0]" host] + ["[1]/[0]" primitive] + ["[1]/[0]" type] + ["[1]/[0]" value] + ["[1]/[0]" runtime] + ["[1]/[0]" complex] + ["[1]/[0]" function] + ["[1]/[0]" reference]])) + ... "JavaScript" (.,, (.these ["[1]/[0]" js])) + ... "Lua" (.,, (.these ["[1]/[0]" lua])) + ... "Python" (.,, (.these ["[1]/[0]" python])) + ... "Ruby" (.,, (.these ["[1]/[0]" ruby])) + (.,, (.these))))]]))) (def (injection value) (All (_ of) @@ -215,19 +223,24 @@ (def .public test Test - (<| (_.covering /._) - (all _.and - (_.for [/.Operation] - ..test|operation) - (_.for [/.Phase] - ..test|phase) - - /translation/jvm/host.test - /translation/jvm/primitive.test - /translation/jvm/type.test - /translation/jvm/value.test - /translation/jvm/runtime.test - /translation/jvm/complex.test - /translation/jvm/function.test - /translation/jvm/reference.test - ))) + (`` (`` (<| (_.covering /._) + (all _.and + (_.for [/.Operation] + ..test|operation) + (_.for [/.Phase] + ..test|phase) + + (,, (.for @.jvm (,, (.these jvm/host.test + jvm/primitive.test + jvm/type.test + jvm/value.test + jvm/runtime.test + jvm/complex.test + jvm/function.test + jvm/reference.test)) + ... "JavaScript" (,, (.these ["[1]/[0]" js])) + ... "Lua" (,, (.these ["[1]/[0]" lua])) + ... "Python" (,, (.these ["[1]/[0]" python])) + ... "Ruby" (,, (.these ["[1]/[0]" ruby])) + (,, (.these)))) + ))))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method.lux index 3e3ec7a84..b5c3e53bc 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method.lux @@ -20,7 +20,8 @@ ["[0]" /]] ["[0]" / ["[1][0]" implementation] - ["[1][0]" reset]]) + ["[1][0]" reset] + ["[1][0]" apply]]) (def (valid_modifier? it) (-> (Modifier Method) @@ -40,4 +41,5 @@ (/implementation.test valid_modifier?) /reset.test + /apply.test ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method/apply.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method/apply.lux new file mode 100644 index 000000000..b3672ca01 --- /dev/null +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method/apply.lux @@ -0,0 +1,75 @@ +... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. +... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. + +(.require + [library + [lux (.except) + [abstract + [monad (.only do)]] + [control + ["[0]" io] + ["[0]" try (.use "[1]#[0]" functor)]] + [math + ["[0]" random (.only Random)] + [number + ["[0]" i64 (.use "[1]#[0]" equivalence)]]] + [meta + [compiler + [meta + ["[0]" archive]]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" / (.only) + [/// + ["[0]" // (.only) + ["[0]" host] + ["[0]" runtime] + [/// + ["[0]" extension] + [// + ["[0]" phase] + ["[0]" synthesis] + ["[0]" translation]]]]]]] + [//// + ["[0]T" complex]]) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + [module (random.lower_cased 1) + + dummy_i64 random.i64 + expected_i64 (random.only (|>> (i64#= dummy_i64) not) + random.i64) + + .let [extender (is extension.Extender + (function (_ _) + (undefined))) + next (//.translate extender complexT.lux) + @ [module 0 0]]]) + (all _.and + (_.coverage [/.method] + (|> (do try.monad + [[_ archive] (archive.reserve "" archive.empty) + [_ archive] (archive.reserve module archive) + .let [[_ host] (io.run! host.host) + state (is runtime.State + (translation.state host module))]] + (<| (phase.result state) + (do phase.monad + [_ (translation.set_buffer translation.empty_buffer) + parameter (next archive (synthesis.i64 @ expected_i64)) + actual (next archive (<| (synthesis.function/apply @) + [(synthesis.function/abstraction @ [(list) 2 (synthesis.variable/local @ 1)]) + (list (synthesis.i64 @ expected_i64) + (synthesis.i64 @ dummy_i64))]))] + (in (|> actual + [{.#None}] + (of host evaluate) + (try#each (|>> (as I64) + (i64#= expected_i64))) + (try.else false)))))) + (try.else false))) + ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method/reset.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method/reset.lux index 105161cd1..8680035f3 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method/reset.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/function/method/reset.lux @@ -105,12 +105,12 @@ ((as (-> I64 I64) it) expected_i64)))) - (try.else false) - ) + (try.else false)) can_reset! (|> (do !.monad - [_ partially_applied_function] + [_ partially_applied_function + _ (!.checkcast class)] (/.call class 2)) [{.#None}] (of host evaluate) @@ -120,8 +120,7 @@ it) expected_i64 expected_i64)))) - (try.else false) - )]] + (try.else false))]] (in (and what_happens_when_its_not_reset! can_reset!))))) (try.else false))) diff --git a/stdlib/source/test/lux/meta/compiler/meta/cache/dependency/module.lux b/stdlib/source/test/lux/meta/compiler/meta/cache/dependency/module.lux index 854328124..8644da07e 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/cache/dependency/module.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/cache/dependency/module.lux @@ -45,7 +45,8 @@ (set.of_list text.hash))] (set#= expected actual))) )) - (<| (_.for [/.Dependency]) + (<| (_.for [/.Dependency + /.#module /.#imports]) (all _.and (_.coverage [/.graph] (let [expected (set.of_list text.hash (list module/0 module/1 module/2)) |