diff options
Diffstat (limited to '')
29 files changed, 136 insertions, 95 deletions
diff --git a/stdlib/source/test/aedifex/command/version.lux b/stdlib/source/test/aedifex/command/version.lux index f87424ab6..b501573d7 100644 --- a/stdlib/source/test/aedifex/command/version.lux +++ b/stdlib/source/test/aedifex/command/version.lux @@ -37,7 +37,7 @@ (if open? (try.of_maybe (do maybe.monad - [head (text.nth 0 state) + [head (text.char 0 state) [_ tail] (text.split 1 state)] (in [[open? tail] head]))) (exception.except ..console_is_closed! []))) diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 63d468945..ca533e853 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -10,8 +10,7 @@ ["@" target] ["." meta] [abstract - [monad (#+ do)] - [predicate (#+ Predicate)]] + [monad (#+ do)]] [control ["." io] [concurrency @@ -21,11 +20,13 @@ ["." text ("#\." equivalence) ["%" format (#+ format)]] [collection - ["." list]]] + ["." list] + ["." set (#+ Set)]]] ["." macro + [syntax (#+ syntax:)] ["." code ("#\." equivalence)]] ["." math - ["." random (#+ Random) ("#\." functor)] + ["." random ("#\." functor)] [number [i8 (#+)] [i16 (#+)] @@ -462,8 +463,7 @@ expected_left random.nat expected_right random.nat - #let [existential_type (: (Random /.Type) - (\ ! map (|>> #.Ex) random.nat))] + #let [existential_type (\ ! map (|>> #.Ex) random.nat)] expected/0 existential_type expected/1 existential_type] (<| (_.for [/.Type]) @@ -1051,6 +1051,46 @@ I16))) ))) +(def: possible_targets + (Set @.Target) + (<| (set.of_list text.hash) + (list @.old + @.js + @.jvm + @.lua + @.python + @.ruby))) + +(syntax: (for_meta|Info) + (function (_ lux) + (let [info (get@ #.info lux) + + conforming_target! + (set.member? ..possible_targets (get@ #.target info)) + + compiling! + (case (get@ #.mode info) + #.Build true + _ false)] + (#.Right [lux (list (code.bit (and conforming_target! + compiling!)))])))) + +(syntax: (for_meta|Module_State) + (do meta.monad + [prelude_module (meta.module .prelude_module)] + (in (list (code.bit (case (get@ #.module_state prelude_module) + #.Active false + _ true)))))) + +(def: for_meta + Test + ($_ _.and + (_.cover [/.Mode /.Info] + (for_meta|Info)) + (_.cover [/.Module_State] + (for_meta|Module_State)) + )) + (def: test Test (<| (_.covering /._) @@ -1076,6 +1116,7 @@ ..for_control_flow ..for_def: ..for_import + ..for_meta ..sub_tests ))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index 6d60c750f..539ed17f0 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -209,14 +209,14 @@ (in (do async.monad [#let [max_iterations 10] actual (|> [0 sample] - (/.iterate (function (_ [iterations current]) - (async.resolved - (if (n.< max_iterations iterations) - (#.Some [[(inc iterations) (n.+ shift current)] - current]) - #.None)))) + (/.iterations (function (_ [iterations current]) + (async.resolved + (if (n.< max_iterations iterations) + (#.Some [[(inc iterations) (n.+ shift current)] + current]) + #.None)))) /.consume)] - (_.cover' [/.iterate] + (_.cover' [/.iterations] (and (n.= max_iterations (list.size actual)) (list\= (list.folds n.+ sample (list.repeat (dec max_iterations) shift)) actual))))) diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 7b1643b79..7d1cbcf53 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -45,16 +45,16 @@ (case (/.except ..an_exception []) (#try.Success _) false (#try.Failure _) true)) - (_.cover [/.construct] + (_.cover [/.error] (case (/.except ..an_exception []) (#try.Success _) false (#try.Failure message) - (text\= message (/.construct ..an_exception [])))) + (text\= message (/.error ..an_exception [])))) (_.cover [/.match?] (/.match? ..an_exception - (/.construct ..an_exception []))) + (/.error ..an_exception []))) (_.cover [/.assertion] (case (/.assertion ..an_exception [] assertion_succeeded?) (#try.Success _) @@ -62,7 +62,7 @@ (#try.Failure message) (and (not assertion_succeeded?) - (text\= message (/.construct ..an_exception []))))) + (text\= message (/.error ..an_exception []))))) (_.cover [/.catch] (and (n.= expected (|> (/.except ..an_exception []) @@ -85,8 +85,8 @@ (text.contains? value0 report) (text.contains? field1 report) (text.contains? value1 report)))) - (_.cover [/.enumerate] - (let [enumeration (/.enumerate %.text (list field0 value0 field1 value1))] + (_.cover [/.listing] + (let [enumeration (/.listing %.text (list field0 value0 field1 value1))] (and (text.contains? field0 enumeration) (text.contains? value0 enumeration) (text.contains? field1 enumeration) @@ -97,7 +97,7 @@ (#try.Failure _) false) (case (/.with ..an_exception [] (#try.Failure "")) (#try.Success _) false - (#try.Failure message) (text\= message (/.construct ..an_exception []))) + (#try.Failure message) (text\= message (/.error ..an_exception []))) (case (/.with ..an_exception [] (: (Try Nat) (/.except ..another_exception []))) @@ -105,8 +105,8 @@ false (#try.Failure message) - (and (text.contains? (/.construct ..an_exception []) message) - (text.contains? (/.construct ..another_exception []) message))))) + (and (text.contains? (/.error ..an_exception []) message) + (text.contains? (/.error ..another_exception []) message))))) (_.cover [/.exception:] (case (/.except ..custom_exception [expected]) (#try.Success _) diff --git a/stdlib/source/test/lux/control/parser/text.lux b/stdlib/source/test/lux/control/parser/text.lux index c8fa56388..1285428cd 100644 --- a/stdlib/source/test/lux/control/parser/text.lux +++ b/stdlib/source/test/lux/control/parser/text.lux @@ -160,7 +160,7 @@ (text.join_with "")))) expected (\ ! map (function (_ value) (|> options - (text.nth (n.% num_options value)) + (text.char (n.% num_options value)) maybe.assume)) random.nat) invalid (random.only (function (_ char) @@ -186,7 +186,7 @@ (text.join_with "")))) invalid (\ ! map (function (_ value) (|> options - (text.nth (n.% num_options value)) + (text.char (n.% num_options value)) maybe.assume)) random.nat) expected (random.only (function (_ char) diff --git a/stdlib/source/test/lux/control/region.lux b/stdlib/source/test/lux/control/region.lux index 9bd903d71..abda4177c 100644 --- a/stdlib/source/test/lux/control/region.lux +++ b/stdlib/source/test/lux/control/region.lux @@ -127,7 +127,7 @@ (do {! (/.monad !)} [_ (monad.map ! (/.acquire //@ count_clean_up) (enum.range n.enum 1 expected_clean_ups)) - _ (/.failure //@ (exception.construct ..oops []))] + _ (/.failure //@ (exception.error ..oops []))] (in []))) actual_clean_ups (thread.read clean_up_counter)] (in (and (..throws? ..oops outcome) diff --git a/stdlib/source/test/lux/control/remember.lux b/stdlib/source/test/lux/control/remember.lux index bd9833aec..2243f8584 100644 --- a/stdlib/source/test/lux/control/remember.lux +++ b/stdlib/source/test/lux/control/remember.lux @@ -114,9 +114,9 @@ ($_ _.and (_.cover [/.must_remember] (and (test_failure deadline message #.None - (exception.construct /.must_remember [deadline deadline message #.None])) + (exception.error /.must_remember [deadline deadline message #.None])) (test_failure deadline message (#.Some focus) - (exception.construct /.must_remember [deadline deadline message (#.Some focus)])))) + (exception.error /.must_remember [deadline deadline message (#.Some focus)])))) (_.cover [/.remember] (..test_macro /.remember "")) (_.cover [/.to_do] diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index 872c21e2d..209dfe143 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -165,9 +165,9 @@ (/\map product.right enumeration))] (and has_correct_indices! has_correct_values!))) - (_.cover [/.nth] + (_.cover [/.item] (/.every? (function (_ [index expected]) - (case (/.nth index sample) + (case (/.item index sample) (#.Some actual) (n.= expected actual) @@ -413,15 +413,15 @@ (and (n.= (|> (/.size sample) (n.* 2) dec) (/.size sample+)) (|> sample+ /.pairs (/.every? (|>> product.right (n.= separator)))))))) - (_.cover [/.iterate] + (_.cover [/.iterations] (or (/.empty? sample) (let [size (/.size sample)] (/\= (/.indices size) - (/.iterate (function (_ index) - (if (n.< size index) - (#.Some (inc index)) - #.None)) - 0))))) + (/.iterations (function (_ index) + (if (n.< size index) + (#.Some (inc index)) + #.None)) + 0))))) (_.cover [/.folds] (/\= (/\map (function (_ index) (\ /.fold fold n.+ 0 (/.take index sample))) diff --git a/stdlib/source/test/lux/data/collection/row.lux b/stdlib/source/test/lux/data/collection/row.lux index 902fec0d8..4eda82b14 100644 --- a/stdlib/source/test/lux/data/collection/row.lux +++ b/stdlib/source/test/lux/data/collection/row.lux @@ -91,8 +91,8 @@ random.nat) #let [sample (|> sample set.to_list /.of_list)]] ($_ _.and - (_.cover [/.nth] - (case (/.nth good_index sample) + (_.cover [/.item] + (case (/.item good_index sample) (#try.Success member) (/.member? n.equivalence sample member) @@ -102,14 +102,14 @@ (<| (try.else false) (do try.monad [sample (/.put good_index non_member sample) - actual (/.nth good_index sample)] + actual (/.item good_index sample)] (in (is? non_member actual))))) (_.cover [/.update] (<| (try.else false) (do try.monad [sample (/.put good_index non_member sample) sample (/.update good_index inc sample) - actual (/.nth good_index sample)] + actual (/.item good_index sample)] (in (n.= (inc non_member) actual))))) (_.cover [/.within_bounds?] (and (/.within_bounds? sample good_index) @@ -123,7 +123,7 @@ (#try.Failure error) (exception.match? /.index_out_of_bounds error))))] - (and (fails! (/.nth bad_index sample)) + (and (fails! (/.item bad_index sample)) (fails! (/.put bad_index non_member sample)) (fails! (/.update bad_index inc sample))))) )) diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index 5058fae08..a5ba1f1bc 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -47,57 +47,57 @@ (_.for [/.comonad] ($comonad.spec /.repeat ..equivalence /.comonad)) - (_.cover [/.iterate /.nth] + (_.cover [/.iterations /.item] (n.= (n.+ offset index) - (/.nth index (/.iterate inc offset)))) + (/.item index (/.iterations inc offset)))) (_.cover [/.repeat] (n.= repeated - (/.nth index (/.repeat repeated)))) + (/.item index (/.repeat repeated)))) (_.cover [/.take] (list\= (enum.range n.enum offset (dec (n.+ size offset))) - (/.take size (/.iterate inc offset)))) + (/.take size (/.iterations inc offset)))) (_.cover [/.drop] (list\= (enum.range n.enum offset (dec (n.+ size offset))) - (/.take size (/.drop offset (/.iterate inc 0))))) + (/.take size (/.drop offset (/.iterations inc 0))))) (_.cover [/.split] - (let [[drops takes] (/.split size (/.iterate inc 0))] + (let [[drops takes] (/.split size (/.iterations inc 0))] (and (list\= (enum.range n.enum 0 (dec size)) drops) (list\= (enum.range n.enum size (dec (n.* 2 size))) (/.take size takes))))) (_.cover [/.take_while] (list\= (enum.range n.enum 0 (dec size)) - (/.take_while (n.< size) (/.iterate inc 0)))) + (/.take_while (n.< size) (/.iterations inc 0)))) (_.cover [/.drop_while] (list\= (enum.range n.enum offset (dec (n.+ size offset))) (/.take_while (n.< (n.+ size offset)) - (/.drop_while (n.< offset) (/.iterate inc 0))))) + (/.drop_while (n.< offset) (/.iterations inc 0))))) (_.cover [/.split_while] - (let [[drops takes] (/.split_while (n.< size) (/.iterate inc 0))] + (let [[drops takes] (/.split_while (n.< size) (/.iterations inc 0))] (and (list\= (enum.range n.enum 0 (dec size)) drops) (list\= (enum.range n.enum size (dec (n.* 2 size))) (/.take_while (n.< (n.* 2 size)) takes))))) (_.cover [/.head] (n.= offset - (/.head (/.iterate inc offset)))) + (/.head (/.iterations inc offset)))) (_.cover [/.tail] (list\= (enum.range n.enum (inc offset) (n.+ size offset)) - (/.take size (/.tail (/.iterate inc offset))))) + (/.take size (/.tail (/.iterations inc offset))))) (_.cover [/.only] (list\= (list\map (n.* 2) (enum.range n.enum 0 (dec size))) - (/.take size (/.only n.even? (/.iterate inc 0))))) + (/.take size (/.only n.even? (/.iterations inc 0))))) (_.cover [/.partition] - (let [[evens odds] (/.partition n.even? (/.iterate inc 0))] + (let [[evens odds] (/.partition n.even? (/.iterations inc 0))] (and (n.= (n.* 2 offset) - (/.nth offset evens)) + (/.item offset evens)) (n.= (inc (n.* 2 offset)) - (/.nth offset odds))))) + (/.item offset odds))))) (_.cover [/.unfold] (let [(^open "/\.") /.functor (^open "list\.") (list.equivalence text.equivalence)] (list\= (/.take size - (/\map %.nat (/.iterate inc offset))) + (/\map %.nat (/.iterations inc offset))) (/.take size (/.unfold (function (_ n) [(inc n) (%.nat n)]) offset))))) @@ -107,7 +107,7 @@ (/.take (n.* size (list.size cycle)) (/.cycle [cycle_start cycle_next]))))) (_.cover [/.^sequence&] - (let [(/.^sequence& first second third next) (/.iterate inc offset)] + (let [(/.^sequence& first second third next) (/.iterations inc offset)] (and (n.= offset first) (n.= (n.+ 1 offset) second) (n.= (n.+ 2 offset) third)))) diff --git a/stdlib/source/test/lux/data/format/json.lux b/stdlib/source/test/lux/data/format/json.lux index 063d3ef2f..940f22cd8 100644 --- a/stdlib/source/test/lux/data/format/json.lux +++ b/stdlib/source/test/lux/data/format/json.lux @@ -48,12 +48,12 @@ (syntax: (boolean) (do meta.monad - [value meta.count] + [value meta.seed] (in (list (code.bit (n.even? value)))))) (syntax: (number) (do meta.monad - [value meta.count] + [value meta.seed] (in (list (code.frac (n.frac value)))))) (syntax: (string) diff --git a/stdlib/source/test/lux/data/format/xml.lux b/stdlib/source/test/lux/data/format/xml.lux index e73e4960a..1fec8a797 100644 --- a/stdlib/source/test/lux/data/format/xml.lux +++ b/stdlib/source/test/lux/data/format/xml.lux @@ -37,7 +37,7 @@ (Random Nat) (do {! random.monad} [idx (|> random.nat (\ ! map (n.% (text.size char_range))))] - (in (maybe.assume (text.nth idx char_range))))) + (in (maybe.assume (text.char idx char_range))))) (def: (size bottom top) (-> Nat Nat (Random Nat)) diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index 82a364120..3e063f73a 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -168,8 +168,8 @@ characters (random.set /.hash size (random.ascii/alpha 1)) #let [sample (|> characters set.to_list /.concat)] expected (\ ! map (n.% size) random.nat)] - (_.cover [/.nth] - (case (/.nth expected sample) + (_.cover [/.char] + (case (/.char expected sample) (#.Some char) (case (/.index_of (/.of_char char) sample) (#.Some actual) diff --git a/stdlib/source/test/lux/data/text/encoding.lux b/stdlib/source/test/lux/data/text/encoding.lux index f5670b35f..4cdf461b7 100644 --- a/stdlib/source/test/lux/data/text/encoding.lux +++ b/stdlib/source/test/lux/data/text/encoding.lux @@ -215,7 +215,7 @@ (let [options (list.size ..all_encodings)] (do {! random.monad} [choice (\ ! map (n.% options) random.nat)] - (in (maybe.assume (list.nth choice ..all_encodings)))))) + (in (maybe.assume (list.item choice ..all_encodings)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 6899c6f62..34f37de58 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -71,7 +71,7 @@ (syntax: (static_sample) (do meta.monad - [seed meta.count + [seed meta.seed #let [[_ expected] (random.run (random.pcg32 [seed seed]) (random.ascii 10))]] (in (list (code.text expected))))) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index ed2e8401d..3fcda84d7 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -282,7 +282,7 @@ (do {! random.monad} [choice (\ ! map (n.% (list.size options)) random.nat)] - (in (maybe.assume (list.nth choice options)))))) + (in (maybe.assume (list.item choice options)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index a949e9bf0..e03bd8dc6 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -208,7 +208,7 @@ (do {! random.monad} [choice (\ ! map (n.% (list.size options)) random.nat)] - (in (maybe.assume (list.nth choice options)))))) + (in (maybe.assume (list.item choice options)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/math/modulus.lux b/stdlib/source/test/lux/math/modulus.lux index 16fcdba76..7a3cde72c 100644 --- a/stdlib/source/test/lux/math/modulus.lux +++ b/stdlib/source/test/lux/math/modulus.lux @@ -20,7 +20,7 @@ (syntax: (|divisor|) (do meta.monad - [divisor meta.count] + [divisor meta.seed] (in (list (code.int (case divisor 0 +1 _ (.int divisor))))))) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 4024003c9..1d097ca27 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -103,7 +103,7 @@ offset (\ ! map (n.% spare) random.nat)] (_.cover [/.region] (case size - 0 (\= /.false (/.region size offset)) + 0 (\= /.false (/.region offset size)) _ (\= (|> pattern ## NNNNYYYYNNNN (/.right_shifted offset) @@ -115,7 +115,7 @@ (/.left_shifted offset) ## ____YYYY____ ) - (/.and (/.region size offset) pattern))))) + (/.and (/.region offset size) pattern))))) )))) (def: sub diff --git a/stdlib/source/test/lux/meta.lux b/stdlib/source/test/lux/meta.lux index 92f88dfc6..6855ada9a 100644 --- a/stdlib/source/test/lux/meta.lux +++ b/stdlib/source/test/lux/meta.lux @@ -312,10 +312,10 @@ #.extensions [] #.host []}]] ($_ _.and - (_.cover [/.count] + (_.cover [/.seed] (|> (do /.monad - [pre /.count - post /.count] + [pre /.seed + post /.seed] (in [pre post])) (/.run expected_lux) (!expect (^multi (#try.Success [actual_pre actual_post]) @@ -719,12 +719,12 @@ (/.run expected_lux) (try\map (\ (maybe.equivalence (list.equivalence name.equivalence)) = (#.Some tags_1))) (try.else false))) - (_.cover [/.resolve_tag] + (_.cover [/.tag] (|> tags_1 list.enumeration (list.every? (function (_ [expected_index tag]) (|> tag - /.resolve_tag + /.tag (/.run expected_lux) (!expect (^multi (^ (#try.Success [actual_index actual_tags actual_type])) (let [correct_index! diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index 1f52753d1..f15340fc4 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -1502,7 +1502,7 @@ (\ ! map (|>> (:as java/lang/Long) ffi.long_to_int ffi.int_to_long (:as Int))) (random.set i.hash options) (\ ! map set.to_list)) - #let [choice (maybe.assume (list.nth choice options))] + #let [choice (maybe.assume (list.item choice options))] expected ..$Long::random dummy ..$Long::random]) (..bytecode ((!::= java/lang/Long "jvm leq" "jvm long =") expected)) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux index 4afc28a2d..425872c1a 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/case.lux @@ -123,8 +123,8 @@ (r\map product.right _primitive.primitive) (do {! r.monad} [choice (|> r.nat (\ ! map (n.% (list.size variant_tags)))) - #let [choiceT (maybe.assume (list.nth choice variant_tags)) - choiceC (maybe.assume (list.nth choice primitivesC))]] + #let [choiceT (maybe.assume (list.item choice variant_tags)) + choiceC (maybe.assume (list.item choice primitivesC))]] (in (` ((~ choiceT) (~ choiceC))))) (do {! r.monad} [size (|> r.nat (\ ! map (n.% 3))) @@ -189,7 +189,7 @@ #let [redundant_branchesC (<| (list!map (branch outputC)) list.concat (list (list.take redundancy_idx redundant_patterns) - (list (maybe.assume (list.nth redundancy_idx redundant_patterns))) + (list (maybe.assume (list.item redundancy_idx redundant_patterns))) (list.drop redundancy_idx redundant_patterns)))]] (_.test "Will reject redundant pattern-matching." (|> (analyse_pm redundant_branchesC) @@ -199,7 +199,7 @@ _primitive.primitive) heterogeneous_idx (|> r.nat (\ ! map (n.% (list.size exhaustive_patterns)))) #let [heterogeneous_branchesC (list.concat (list (list.take heterogeneous_idx exhaustive_branchesC) - (list (let [[_pattern _body] (maybe.assume (list.nth heterogeneous_idx exhaustive_branchesC))] + (list (let [[_pattern _body] (maybe.assume (list.item heterogeneous_idx exhaustive_branchesC))] [_pattern heterogeneousC])) (list.drop (inc heterogeneous_idx) exhaustive_branchesC)))]] (_.test "Will reject pattern-matching if the bodies of the branches do not all have the same type." diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux index 1cf61d839..c59de0da6 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/function.lux @@ -96,7 +96,7 @@ (list varT) (list.drop (inc var_idx) inputsT)))) varT) - poly_inputT (maybe.assume (list.nth var_idx inputsT)) + poly_inputT (maybe.assume (list.item var_idx inputsT)) partial_poly_inputsT (list.drop (inc var_idx) inputsT) partial_polyT1 (<| (type.function partial_poly_inputsT) poly_inputT) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux index c4f35feea..c4a1a50b9 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/analysis/structure.lux @@ -124,12 +124,12 @@ +choice (|> r.nat (\ ! map (n.% (inc size)))) [_ +valueC] _primitive.primitive #let [variantT (type.variant (list\map product.left primitives)) - [valueT valueC] (maybe.assume (list.nth choice primitives)) + [valueT valueC] (maybe.assume (list.item choice primitives)) +size (inc size) +primitives (list.concat (list (list.take choice primitives) (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) - [+valueT +valueC] (maybe.assume (list.nth +choice +primitives)) + [+valueT +valueC] (maybe.assume (list.item +choice +primitives)) +variantT (type.variant (list\map product.left +primitives))]] (<| (_.context (%.name (name_of /.sum))) ($_ _.and @@ -175,7 +175,7 @@ choice (|> r.nat (\ ! map (n.% size))) [_ +valueC] _primitive.primitive #let [tupleT (type.tuple (list\map product.left primitives)) - [singletonT singletonC] (|> primitives (list.nth choice) maybe.assume) + [singletonT singletonC] (|> primitives (list.item choice) maybe.assume) +primitives (list.concat (list (list.take choice primitives) (list [(#.Parameter 1) +valueC]) (list.drop choice primitives))) @@ -240,15 +240,15 @@ #let [with_name (|>> (#.Named [module_name type_name])) varT (#.Parameter 1) primitivesT (list\map product.left primitives) - [choiceT choiceC] (maybe.assume (list.nth choice primitives)) - [other_choiceT other_choiceC] (maybe.assume (list.nth other_choice primitives)) + [choiceT choiceC] (maybe.assume (list.item choice primitives)) + [other_choiceT other_choiceC] (maybe.assume (list.item other_choice primitives)) monoT (type.variant primitivesT) polyT (|> (type.variant (list.concat (list (list.take choice primitivesT) (list varT) (list.drop (inc choice) primitivesT)))) (type.univ_q 1)) - choice_tag (maybe.assume (list.nth choice tags)) - other_choice_tag (maybe.assume (list.nth other_choice tags))]] + choice_tag (maybe.assume (list.item choice tags)) + other_choice_tag (maybe.assume (list.item other_choice tags))]] (<| (_.context (%.name (name_of /.tagged_sum))) ($_ _.and (_.test "Can infer." diff --git a/stdlib/source/test/lux/type/resource.lux b/stdlib/source/test/lux/type/resource.lux index a281a476b..4bfb49503 100644 --- a/stdlib/source/test/lux/type/resource.lux +++ b/stdlib/source/test/lux/type/resource.lux @@ -32,7 +32,7 @@ [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) #let [! identity.monad]] - (_.for [/.Linear /.run] + (_.for [/.Linear /.run /.monad] (`` ($_ _.and (~~ (template [<coverage> <bindings>] [(_.cover <coverage> @@ -74,7 +74,7 @@ [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) #let [! io.monad]] - (_.for [/.Linear /.run] + (_.for [/.Linear /.run /.monad] (`` ($_ _.and (~~ (template [<coverage> <bindings>] [(_.cover <coverage> @@ -117,7 +117,7 @@ [pre (\ ! map %.nat random.nat) post (\ ! map %.nat random.nat) #let [! async.monad]] - (_.for [/.Linear /.run] + (_.for [/.Linear /.run /.monad] (`` ($_ _.and (~~ (template [<coverage> <bindings>] [(in (monad.do ! diff --git a/stdlib/source/test/lux/type/unit.lux b/stdlib/source/test/lux/type/unit.lux index 683bf504c..9557d522d 100644 --- a/stdlib/source/test/lux/type/unit.lux +++ b/stdlib/source/test/lux/type/unit.lux @@ -80,7 +80,7 @@ (syntax: (natural) (\ meta.monad map (|>> code.nat list) - meta.count)) + meta.seed)) (with_expansions [<from> (..natural) <to> (..natural)] diff --git a/stdlib/source/test/lux/world/console.lux b/stdlib/source/test/lux/world/console.lux index 5a815c294..003c20c34 100644 --- a/stdlib/source/test/lux/world/console.lux +++ b/stdlib/source/test/lux/world/console.lux @@ -25,7 +25,7 @@ (implementation (def: (on_read [dead? content]) (do try.monad - [char (try.of_maybe (text.nth 0 content)) + [char (try.of_maybe (text.char 0 content)) [_ content] (try.of_maybe (text.split 1 content))] (if dead? (exception.except ..dead []) diff --git a/stdlib/source/test/lux/world/input/keyboard.lux b/stdlib/source/test/lux/world/input/keyboard.lux index 24b657f0d..e0064f29b 100644 --- a/stdlib/source/test/lux/world/input/keyboard.lux +++ b/stdlib/source/test/lux/world/input/keyboard.lux @@ -140,7 +140,7 @@ (let [count (list.size ..listing)] (do {! random.monad} [choice (\ ! map (n.% count) random.nat)] - (in (maybe.assume (list.nth choice ..listing)))))) + (in (maybe.assume (list.item choice ..listing)))))) (def: #export test Test diff --git a/stdlib/source/test/lux/world/output/video/resolution.lux b/stdlib/source/test/lux/world/output/video/resolution.lux index 411ae288d..378352c57 100644 --- a/stdlib/source/test/lux/world/output/video/resolution.lux +++ b/stdlib/source/test/lux/world/output/video/resolution.lux @@ -47,7 +47,7 @@ (let [count (list.size ..listing)] (do {! random.monad} [choice (\ ! map (n.% count) random.nat)] - (in (maybe.assume (list.nth choice ..listing)))))) + (in (maybe.assume (list.item choice ..listing)))))) (def: #export test Test |