From 464b6e8f5e6c62f58fa8c7ff61ab2ad215e98bd1 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 9 Aug 2021 23:02:01 -0400 Subject: Improved single-line comment syntax (from "##" to "..."). --- stdlib/source/test/aedifex/cli.lux | 16 +++---- stdlib/source/test/aedifex/command/auto.lux | 4 +- stdlib/source/test/aedifex/command/install.lux | 4 +- .../source/test/aedifex/dependency/deployment.lux | 6 +-- .../source/test/aedifex/dependency/resolution.lux | 6 +-- stdlib/source/test/aedifex/repository.lux | 4 +- stdlib/source/test/lux.lux | 53 +++++++++++++--------- stdlib/source/test/lux/abstract/comonad/cofree.lux | 2 +- .../source/test/lux/control/concurrency/actor.lux | 38 ++++++++-------- .../source/test/lux/control/concurrency/async.lux | 30 ++++++------ .../source/test/lux/control/concurrency/atom.lux | 22 ++++----- stdlib/source/test/lux/control/concurrency/frp.lux | 8 ++-- .../test/lux/control/concurrency/semaphore.lux | 26 +++++------ stdlib/source/test/lux/control/concurrency/stm.lux | 2 +- .../source/test/lux/control/concurrency/thread.lux | 12 ++--- stdlib/source/test/lux/control/continuation.lux | 6 +-- stdlib/source/test/lux/control/exception.lux | 14 ++---- stdlib/source/test/lux/control/function/memo.lux | 6 +-- stdlib/source/test/lux/control/parser/binary.lux | 2 +- stdlib/source/test/lux/control/parser/xml.lux | 6 +-- stdlib/source/test/lux/data.lux | 4 +- stdlib/source/test/lux/data/binary.lux | 26 +++++------ stdlib/source/test/lux/data/collection/list.lux | 4 +- .../source/test/lux/data/collection/sequence.lux | 10 ++-- stdlib/source/test/lux/data/color/named.lux | 4 +- stdlib/source/test/lux/data/format/tar.lux | 4 +- stdlib/source/test/lux/data/name.lux | 4 +- stdlib/source/test/lux/data/text.lux | 14 +++--- stdlib/source/test/lux/data/text/escape.lux | 22 ++++----- stdlib/source/test/lux/data/text/unicode/block.lux | 2 +- stdlib/source/test/lux/debug.lux | 26 +++++------ stdlib/source/test/lux/extension.lux | 10 ++-- stdlib/source/test/lux/ffi.js.lux | 10 ++-- stdlib/source/test/lux/ffi.jvm.lux | 48 ++++++++++---------- stdlib/source/test/lux/ffi.old.lux | 4 +- stdlib/source/test/lux/locale/language.lux | 30 ++++++------ stdlib/source/test/lux/locale/territory.lux | 14 +++--- stdlib/source/test/lux/macro.lux | 8 ++-- stdlib/source/test/lux/macro/code.lux | 14 +++--- stdlib/source/test/lux/macro/poly/json.lux | 14 +++--- stdlib/source/test/lux/macro/syntax/export.lux | 42 ++++++++++++----- stdlib/source/test/lux/math/number.lux | 2 +- stdlib/source/test/lux/math/number/complex.lux | 6 +-- stdlib/source/test/lux/math/number/i64.lux | 10 ++-- stdlib/source/test/lux/target/jvm.lux | 6 +-- stdlib/source/test/lux/test.lux | 16 +++---- stdlib/source/test/lux/time/duration.lux | 6 +-- stdlib/source/test/lux/time/instant.lux | 2 +- stdlib/source/test/lux/time/month.lux | 4 +- stdlib/source/test/lux/time/year.lux | 2 +- .../compiler/language/lux/phase/synthesis/case.lux | 8 ++-- .../language/lux/phase/synthesis/function.lux | 4 +- .../test/lux/tool/compiler/language/lux/syntax.lux | 2 +- stdlib/source/test/lux/type.lux | 19 +++++++- stdlib/source/test/lux/type/check.lux | 6 +-- stdlib/source/test/lux/type/dynamic.lux | 6 +-- stdlib/source/test/lux/type/refinement.lux | 18 ++++---- stdlib/source/test/lux/world/file/watch.lux | 2 +- stdlib/source/test/lux/world/shell.lux | 2 +- 59 files changed, 370 insertions(+), 332 deletions(-) (limited to 'stdlib/source/test') diff --git a/stdlib/source/test/aedifex/cli.lux b/stdlib/source/test/aedifex/cli.lux index f59cf6619..4b5e79ac5 100644 --- a/stdlib/source/test/aedifex/cli.lux +++ b/stdlib/source/test/aedifex/cli.lux @@ -28,24 +28,24 @@ (def: command (Random /.Command) ($_ random.or - ## #Version + ... #Version (random\in []) - ## #Clean + ... #Clean (random\in []) - ## #POM + ... #POM (random\in []) - ## #Dependencies + ... #Dependencies (random\in []) - ## #Install + ... #Install (random\in []) - ## #Deploy + ... #Deploy ($_ random.and (random.ascii/alpha 1) (random.ascii/alpha 1) (random.ascii/alpha 1)) - ## #Compilation + ... #Compilation ..compilation - ## #Auto + ... #Auto ..compilation)) (def: (compilation_format value) diff --git a/stdlib/source/test/aedifex/command/auto.lux b/stdlib/source/test/aedifex/command/auto.lux index 6a7ef98ab..074eeab5e 100644 --- a/stdlib/source/test/aedifex/command/auto.lux +++ b/stdlib/source/test/aedifex/command/auto.lux @@ -53,7 +53,7 @@ [@runs (function (_ console program fs shell resolution profile) (do {! async.monad} - [[_ actual_runs] (async.future (atom.update inc @runs))] + [[_ actual_runs] (async.future (atom.update! inc @runs))] (if (n.= expected_runs actual_runs) (in (#try.Failure end_signal)) (do (try.with !) @@ -116,7 +116,7 @@ (#try.Success _) false)))) correct_number_of_runs! (|> @runs - atom.read + atom.read! async.future (\ ! map (n.= expected_runs)))] (in (#try.Success (and correct_number_of_runs! diff --git a/stdlib/source/test/aedifex/command/install.lux b/stdlib/source/test/aedifex/command/install.lux index 0ca484196..a3cd99edd 100644 --- a/stdlib/source/test/aedifex/command/install.lux +++ b/stdlib/source/test/aedifex/command/install.lux @@ -84,11 +84,11 @@ library_exists! (|> library_path (format home /) (\ fs file?) - (\ async.monad map exception.return)) + (\ async.monad map (|>> #try.Success))) pom_exists! (|> pom_path (format home /) (\ fs file?) - (\ async.monad map exception.return))] + (\ async.monad map (|>> #try.Success)))] (in (and succeeded! library_exists! pom_exists!)))] diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index ec2ecad3d..0add3a487 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -69,7 +69,7 @@ [_ (: (IO Any) (case [method input] [#@http.Put (#.Some input)] - (atom.update (dictionary.put url input) cache) + (atom.update! (dictionary.put url input) cache) _ (in [])))] @@ -158,7 +158,7 @@ repository (repository.async (remote.repository http #.None address))]] (in (do async.monad [?outcome (/.one repository dependency package) - cache (async.future (atom.read cache))] + cache (async.future (atom.read! cache))] (_.cover' [/.one] (|> ?outcome (try\map (verify_one 1 address package cache expected_artifact)) @@ -181,7 +181,7 @@ repository (repository.async (remote.repository http #.None address))]] (in (do async.monad [?outcome (/.all repository resolution) - cache (async.future (atom.read cache))] + cache (async.future (atom.read! cache))] (_.cover' [/.all] (|> ?outcome (try\map (function (_ actual_artifacts) diff --git a/stdlib/source/test/aedifex/dependency/resolution.lux b/stdlib/source/test/aedifex/dependency/resolution.lux index 01b57eb62..4bef34eff 100644 --- a/stdlib/source/test/aedifex/dependency/resolution.lux +++ b/stdlib/source/test/aedifex/dependency/resolution.lux @@ -132,7 +132,7 @@ (text.ends_with? ..pom_md5 uri) (#try.Success [state (..md5 pom)]) - ## else + ... else (#try.Failure "NOPE"))) (#try.Failure "NOPE"))) (def: (on_upload uri binary state) @@ -185,7 +185,7 @@ (\ utf8.codec encode) ..md5)]) - ## else + ... else (#try.Failure "NOPE")) (#try.Failure "NOPE"))) (def: (on_upload uri binary state) @@ -238,7 +238,7 @@ (\ utf8.codec encode) ..md5)]) - ## else + ... else (#try.Failure "NOPE")) (#try.Failure "NOPE"))) (def: (on_upload uri binary state) diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index eead05e89..478f02d7e 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -75,14 +75,14 @@ (#.Some content) (case (binary.size content) 0 (exception.except ..not_found [uri]) - _ (exception.return [state content])) + _ (#try.Success [state content])) #.None (exception.except ..not_found [uri]))) (def: (on_upload uri content state) (if (dictionary.key? state uri) (exception.except ..cannot_upload [uri]) - (exception.return (dictionary.put uri content state))))) + (#try.Success (dictionary.put uri content state))))) (def: .public test Test diff --git a/stdlib/source/test/lux.lux b/stdlib/source/test/lux.lux index 925894d7b..a659b6523 100644 --- a/stdlib/source/test/lux.lux +++ b/stdlib/source/test/lux.lux @@ -8,7 +8,6 @@ [program (#+ program:)] ["_" test (#+ Test)] ["@" target] - ["." meta] [abstract [monad (#+ do)]] [control @@ -34,22 +33,25 @@ ["i" int] ["r" rev] ["f" frac] - ["." i64]]]]] - ## TODO: Must have 100% coverage on tests. + ["." i64]]] + ["." meta + ["." location ("#\." equivalence)]]]] + ... TODO: Must have 100% coverage on tests. ["." / #_ ["#." abstract] ["#." control] ["#." data] ["#." debug] ["#." locale] - ["#." macro] + ["#." macro + ["#/." code]] ["#." math] ["#." meta] ["#." program] ["#." target] ["#." test] ["#." time] - ## ["#." tool] ## TODO: Update & expand tests for this + ... ["#." tool] ... TODO: Update & expand tests for this ["#." type] ["#." world] ["#." ffi] @@ -57,7 +59,7 @@ ["#." target #_ ]])) -## TODO: Get rid of this ASAP +... TODO: Get rid of this ASAP (template: (!bundle body) [(: Test (do random.monad @@ -66,7 +68,7 @@ (def: sub_tests Test - (with_expansions [## TODO: Update & expand tests for this + (with_expansions [... TODO: Update & expand tests for this (for {@.jvm (~~ (as_is /target/jvm.test)) @.old (~~ (as_is /target/jvm.test))} (~~ (as_is))) @@ -86,7 +88,7 @@ /test.test /time.test - ## /tool.test + ... /tool.test /type.test /world.test /ffi.test @@ -129,13 +131,13 @@ (/.cond /.true expected - ## else + ... else dummy)) (n.= expected (/.cond /.false dummy - ## else + ... else expected)) (n.= expected (/.cond /.true @@ -144,7 +146,7 @@ /.false dummy - ## else + ... else dummy)) (n.= expected (/.cond /.false @@ -153,7 +155,7 @@ /.true expected - ## else + ... else dummy)))) )))) @@ -399,13 +401,20 @@ (def: for_code Test (do random.monad - [example_nat random.nat] - (_.for [/.Code /.Code'] - ($_ _.and - ..for_code/' - ..for_code/` - ..for_code/`' - )))) + [example_nat random.nat + example /macro/code.random] + ($_ _.and + (_.for [/.Code /.Code'] + ($_ _.and + ..for_code/' + ..for_code/` + ..for_code/`' + )) + (_.cover [/.Ann] + (|> example + (get@ #/.meta) + (location\= location.dummy))) + ))) (/.macro: (identity_macro tokens) (\ meta.monad in tokens)) @@ -998,10 +1007,10 @@ post (random.only (|>> (n.= pre) not) random.nat) .let [box (atom.atom pre)]] (_.cover [/.exec] - (and (is? pre (io.run (atom.read box))) + (and (is? pre (io.run (atom.read! box))) (/.exec - (io.run (atom.write post box)) - (is? post (io.run (atom.read box))))))) + (io.run (atom.write! post box)) + (is? post (io.run (atom.read! box))))))) )) (def: identity/constant diff --git a/stdlib/source/test/lux/abstract/comonad/cofree.lux b/stdlib/source/test/lux/abstract/comonad/cofree.lux index 531510a04..541977fc5 100644 --- a/stdlib/source/test/lux/abstract/comonad/cofree.lux +++ b/stdlib/source/test/lux/abstract/comonad/cofree.lux @@ -21,7 +21,7 @@ (def: (injection value) (Injection (/.CoFree Sequence)) - [value (sequence\map injection (sequence.repeat value))]) + [value (sequence\map injection (sequence.repeated value))]) (def: (interpret [head tail]) (All [a] (-> (/.CoFree Sequence a) (Sequence a))) diff --git a/stdlib/source/test/lux/control/concurrency/actor.lux b/stdlib/source/test/lux/control/concurrency/actor.lux index 618271a6e..b97f6498f 100644 --- a/stdlib/source/test/lux/control/concurrency/actor.lux +++ b/stdlib/source/test/lux/control/concurrency/actor.lux @@ -103,7 +103,7 @@ (in outcome))))}) [])] (/.poison! actor))) - _ (async.wait 100) + _ (async.delay 100) result (async.future (async.poll read))] (_.cover' [/.poisoned] (case result @@ -143,9 +143,9 @@ [actor (/.spawn! /.default initial_state) sent? (/.mail! die! actor) alive? (/.alive? actor) - obituary (/.obituary actor)] + obituary (/.obituary' actor)] (in (#try.Success [actor sent? alive? obituary]))))] - (_.cover' [/.Obituary /.obituary] + (_.cover' [/.Obituary /.obituary'] (case result (^ (#try.Success [actor sent? alive? (#.Some [error state (list single_pending_message)])])) (and (..mailed? sent?) @@ -184,7 +184,7 @@ sent/inc? (/.mail! inc! anonymous) sent/dec? (/.mail! dec! anonymous) poisoned? (/.poison! anonymous) - obituary (/.obituary anonymous)] + obituary (/.obituary' anonymous)] (in (and (..mailed? sent/inc?) (..mailed? sent/dec?) (..mailed? poisoned?) @@ -210,21 +210,21 @@ [agent (async.future (do {! io.monad} [agent (/.actor {Nat 0}) - _ (/.observe (function (_ event stop) - (function (_ events_seen self) - (async.future - (if (n.< num_observations events_seen) - (do ! - [_ (atom.update (row.add event) sink)] - (in (#try.Success (inc events_seen)))) - (do ! - [_ stop] - (in (#try.Failure "YOLO"))))))) - (frp.sequential 0 events) - agent)] + _ (/.observe! (function (_ event stop) + (function (_ events_seen self) + (async.future + (if (n.< num_observations events_seen) + (do ! + [_ (atom.update! (row.add event) sink)] + (in (#try.Success (inc events_seen)))) + (do ! + [_ stop] + (in (#try.Failure "YOLO"))))))) + (frp.sequential 0 events) + agent)] (in agent))) - _ (/.await agent) - actual (async.future (atom.read sink))] - (_.cover' [/.Stop /.observe /.await] + _ (/.obituary agent) + actual (async.future (atom.read! sink))] + (_.cover' [/.Stop /.observe! /.obituary] (\ (list.equivalence n.equivalence) = expected (row.list actual)))))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/async.lux b/stdlib/source/test/lux/control/concurrency/async.lux index b16aa0bf2..f4353bc4f 100644 --- a/stdlib/source/test/lux/control/concurrency/async.lux +++ b/stdlib/source/test/lux/control/concurrency/async.lux @@ -86,17 +86,17 @@ (n.= expected actual)))) (in (do /.monad [pre (/.future instant.now) - actual (/.schedule waiting_time (io.io expected)) + actual (/.schedule! waiting_time (io.io expected)) post (/.future instant.now)] - (_.cover' [/.schedule] + (_.cover' [/.schedule!] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) (in (do /.monad [pre (/.future instant.now) - _ (/.wait waiting_time) + _ (/.delay waiting_time) post (/.future instant.now)] - (_.cover' [/.wait] + (_.cover' [/.delay] (i.>= (.int waiting_time) (duration.millis (instant.span pre post)))))) (in (do /.monad @@ -107,16 +107,16 @@ (n.+ leftA rightA))))) (in (do /.monad [pre (/.future instant.now) - actual (/.delay waiting_time expected) + actual (/.delayed waiting_time expected) post (/.future instant.now)] - (_.cover' [/.delay] + (_.cover' [/.delayed] (and (n.= expected actual) (i.>= (.int waiting_time) (duration.millis (instant.span pre post))))))) (in (do /.monad [?left (/.or (in leftE) - (/.delay waiting_time dummy)) - ?right (/.or (/.delay waiting_time dummy) + (/.delayed waiting_time dummy)) + ?right (/.or (/.delayed waiting_time dummy) (in rightE))] (_.cover' [/.or] (case [?left ?right] @@ -128,8 +128,8 @@ false)))) (in (do /.monad [leftA (/.either (in leftE) - (/.delay waiting_time dummy)) - rightA (/.either (/.delay waiting_time dummy) + (/.delayed waiting_time dummy)) + rightA (/.either (/.delayed waiting_time dummy) (in rightE))] (_.cover' [/.either] (n.= (n.+ leftE rightE) @@ -155,7 +155,7 @@ (and yep (not nope))))) (in (do /.monad - [?none (/.time_out 0 (/.delay waiting_time dummy)) + [?none (/.time_out 0 (/.delayed waiting_time dummy)) ?actual (/.time_out waiting_time (in expected))] (_.cover' [/.time_out] (case [?none ?actual] @@ -167,10 +167,10 @@ (in (do /.monad [.let [box (: (Atom Nat) (atom.atom dummy))] - _ (/.future (/.await (function (_ value) - (atom.write value box)) + _ (/.future (/.upon! (function (_ value) + (atom.write! value box)) (/.resolved expected))) - actual (/.future (atom.read box))] - (_.cover' [/.await] + actual (/.future (atom.read! box))] + (_.cover' [/.upon!] (n.= expected actual)))) )))) diff --git a/stdlib/source/test/lux/control/concurrency/atom.lux b/stdlib/source/test/lux/control/concurrency/atom.lux index aec2d56d9..e3c5a9b89 100644 --- a/stdlib/source/test/lux/control/concurrency/atom.lux +++ b/stdlib/source/test/lux/control/concurrency/atom.lux @@ -20,22 +20,22 @@ (do random.monad [expected random.nat .let [box (/.atom expected)]] - (_.cover [/.Atom /.atom /.read] + (_.cover [/.Atom /.atom /.read!] (io.run (do io.monad - [actual (/.read box)] + [actual (/.read! box)] (in (is? expected actual)))))) (do random.monad [target random.nat unknown (random.only (|>> (is? target) not) random.nat) expected random.nat .let [box (/.atom target)]] - (_.cover [/.compare_and_swap] + (_.cover [/.compare_and_swap!] (io.run (do io.monad - [swapped_unknown? (/.compare_and_swap unknown expected box) - swapped_target? (/.compare_and_swap target expected box) - actual (/.read box)] + [swapped_unknown? (/.compare_and_swap! unknown expected box) + swapped_target? (/.compare_and_swap! target expected box) + actual (/.read! box)] (in (and (not swapped_unknown?) swapped_target? (is? expected actual))))))) @@ -43,10 +43,10 @@ [init random.nat shift random.nat .let [box (/.atom init)]] - (_.cover [/.update] + (_.cover [/.update!] (io.run (do io.monad - [[pre post] (/.update (n.+ shift) box)] + [[pre post] (/.update! (n.+ shift) box)] (in (and (is? init pre) (n.= (n.+ shift init) post))))))) @@ -54,11 +54,11 @@ [pre random.nat post random.nat .let [box (/.atom pre)]] - (_.cover [/.write] + (_.cover [/.write!] (io.run (do io.monad - [old (/.write post box) - new (/.read box)] + [old (/.write! post box) + new (/.read! box)] (in (and (is? pre old) (is? post new))))))) ))) diff --git a/stdlib/source/test/lux/control/concurrency/frp.lux b/stdlib/source/test/lux/control/concurrency/frp.lux index ecb6d7c93..675eabfa3 100644 --- a/stdlib/source/test/lux/control/concurrency/frp.lux +++ b/stdlib/source/test/lux/control/concurrency/frp.lux @@ -144,8 +144,8 @@ (atom.atom row.empty))] _ (async.future (/.subscribe (function (_ value) (do {! io.monad} - [current (atom.read sink) - _ (atom.update (row.add value) sink)] + [current (atom.read! sink) + _ (atom.update! (row.add value) sink)] (if (n.< (list.size inputs) (inc (row.size current))) (in (#.Some [])) @@ -155,7 +155,7 @@ (/.sequential 0 (list\compose inputs inputs)))) _ ?signal listened (|> sink - atom.read + atom.read! async.future (\ ! map row.list))] (_.cover' [/.Subscriber /.subscribe] @@ -218,6 +218,6 @@ /.consume)] (_.cover' [/.iterations] (and (n.= max_iterations (list.size actual)) - (list\= (list.folds n.+ sample (list.repeat (dec max_iterations) shift)) + (list\= (list.folds n.+ sample (list.repeated (dec max_iterations) shift)) actual))))) ))))) diff --git a/stdlib/source/test/lux/control/concurrency/semaphore.lux b/stdlib/source/test/lux/control/concurrency/semaphore.lux index 33c5e1da1..58492c733 100644 --- a/stdlib/source/test/lux/control/concurrency/semaphore.lux +++ b/stdlib/source/test/lux/control/concurrency/semaphore.lux @@ -54,7 +54,7 @@ [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} - [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) + [_ (monad.map ! /.wait (list.repeated initial_open_positions semaphore)) result (async.time_out ..delay (/.wait semaphore))] (_.cover' [/.wait] (case result @@ -67,7 +67,7 @@ [initial_open_positions (|> random.nat (\ ! map (|>> (n.% 10) (n.max 1)))) .let [semaphore (/.semaphore initial_open_positions)]] (in (do {! async.monad} - [_ (monad.map ! /.wait (list.repeat initial_open_positions semaphore)) + [_ (monad.map ! /.wait (list.repeated initial_open_positions semaphore)) .let [block (/.wait semaphore)] result/0 (async.time_out ..delay block) open_positions (/.signal semaphore) @@ -100,29 +100,29 @@ (do {! random.monad} [repetitions (|> random.nat (\ ! map (|>> (n.% 100) (n.max 10)))) .let [resource (atom.atom "") - expected_As (text.join_with "" (list.repeat repetitions "A")) - expected_Bs (text.join_with "" (list.repeat repetitions "B")) + expected_As (text.join_with "" (list.repeated repetitions "A")) + expected_Bs (text.join_with "" (list.repeated repetitions "B")) mutex (/.mutex []) processA (<| (/.synchronize mutex) io.io async.future (do {! io.monad} [_ (<| (monad.seq !) - (list.repeat repetitions) - (atom.update (|>> (format "A")) resource))] + (list.repeated repetitions) + (atom.update! (|>> (format "A")) resource))] (in []))) processB (<| (/.synchronize mutex) io.io async.future (do {! io.monad} [_ (<| (monad.seq !) - (list.repeat repetitions) - (atom.update (|>> (format "B")) resource))] + (list.repeated repetitions) + (atom.update! (|>> (format "B")) resource))] (in [])))]] (in (do async.monad [_ processA _ processB - .let [outcome (io.run (atom.read resource))]] + .let [outcome (io.run (atom.read! resource))]] (_.cover' [/.mutex /.synchronize] (or (text\= (format expected_As expected_Bs) outcome) @@ -134,7 +134,7 @@ (-> (Atom Text) /.Barrier Nat (Async Any)) (do async.monad [_ (/.block barrier) - _ (async.future (atom.update (|>> (format (%.nat id))) resource))] + _ (async.future (atom.update! (|>> (format (%.nat id))) resource))] (in []))) (def: barrier @@ -161,15 +161,15 @@ (in (do {! async.monad} [.let [suffix "_" expected_ending (|> suffix - (list.repeat limit) + (list.repeated limit) (text.join_with "")) expected_ids (enum.range n.enum 0 (dec limit))] _ (|> expected_ids (list\map (function (_ id) - (exec (io.run (atom.update (|>> (format suffix)) resource)) + (exec (io.run (atom.update! (|>> (format suffix)) resource)) (waiter resource barrier id)))) (monad.seq !)) - .let [outcome (io.run (atom.read resource))]] + .let [outcome (io.run (atom.read! resource))]] (_.cover' [/.barrier /.block] (and (text.ends_with? expected_ending outcome) (list.every? (function (_ id) diff --git a/stdlib/source/test/lux/control/concurrency/stm.lux b/stdlib/source/test/lux/control/concurrency/stm.lux index 79880064e..7c9b3137d 100644 --- a/stdlib/source/test/lux/control/concurrency/stm.lux +++ b/stdlib/source/test/lux/control/concurrency/stm.lux @@ -93,7 +93,7 @@ changes)))) (in (let [var (/.var 0)] (do {! async.monad} - [_ (|> (list.repeat iterations_per_process []) + [_ (|> (list.repeated iterations_per_process []) (list\map (function (_ _) (/.commit (/.update inc var)))) (monad.seq !)) cummulative (/.commit (/.read var))] diff --git a/stdlib/source/test/lux/control/concurrency/thread.lux b/stdlib/source/test/lux/control/concurrency/thread.lux index 182a05908..bee49206d 100644 --- a/stdlib/source/test/lux/control/concurrency/thread.lux +++ b/stdlib/source/test/lux/control/concurrency/thread.lux @@ -35,12 +35,12 @@ [reference_time (async.future instant.now) .let [box (atom.atom [reference_time dummy])] _ (async.future - (/.schedule delay (do io.monad - [execution_time instant.now] - (atom.write [execution_time expected] box)))) - _ (async.wait (n.* 2 delay)) - [execution_time actual] (async.future (atom.read box))] - (_.cover' [/.schedule] + (/.schedule! delay (do io.monad + [execution_time instant.now] + (atom.write! [execution_time expected] box)))) + _ (async.delay (n.* 2 delay)) + [execution_time actual] (async.future (atom.read! box))] + (_.cover' [/.schedule!] (let [expected_delay! (i.>= (.int delay) (duration.millis (instant.span reference_time execution_time))) diff --git a/stdlib/source/test/lux/control/continuation.lux b/stdlib/source/test/lux/control/continuation.lux index 6635d84b6..a0dcec237 100644 --- a/stdlib/source/test/lux/control/continuation.lux +++ b/stdlib/source/test/lux/control/continuation.lux @@ -53,9 +53,9 @@ (function (_ k) (do ! [temp (k sample)] - ## If this code where to run, - ## the output would be - ## (n.* 4 sample) + ... If this code where to run, + ... the output would be + ... (n.* 4 sample) (k temp))))] (in (n.* 2 value)))))) (_.cover [/.portal] diff --git a/stdlib/source/test/lux/control/exception.lux b/stdlib/source/test/lux/control/exception.lux index 13bde092b..74e73f45b 100644 --- a/stdlib/source/test/lux/control/exception.lux +++ b/stdlib/source/test/lux/control/exception.lux @@ -37,10 +37,6 @@ (<| (_.covering /._) (_.for [/.Exception]) ($_ _.and - (_.cover [/.return] - (case (/.return expected) - (#try.Success actual) (n.= expected actual) - (#try.Failure _) false)) (_.cover [/.except] (case (/.except ..an_exception []) (#try.Success _) false @@ -63,20 +59,20 @@ (#try.Failure message) (and (not assertion_succeeded?) (text\= message (/.error ..an_exception []))))) - (_.cover [/.catch] + (_.cover [/.when] (and (n.= expected (|> (/.except ..an_exception []) - (/.catch ..an_exception (function (_ ex) expected)) + (/.when ..an_exception (function (_ ex) expected)) (/.otherwise (function (_ ex) wrong)))) (n.= expected (|> (/.except ..another_exception []) - (/.catch ..an_exception (function (_ ex) wrong)) - (/.catch ..another_exception (function (_ ex) expected)) + (/.when ..an_exception (function (_ ex) wrong)) + (/.when ..another_exception (function (_ ex) expected)) (/.otherwise (function (_ ex) wrong)))))) (_.cover [/.otherwise] (n.= expected (|> (/.except ..another_exception []) - (/.catch ..an_exception (function (_ ex) wrong)) + (/.when ..an_exception (function (_ ex) wrong)) (/.otherwise (function (_ ex) expected))))) (_.cover [/.report] (let [report (/.report [field0 value0] diff --git a/stdlib/source/test/lux/control/function/memo.lux b/stdlib/source/test/lux/control/function/memo.lux index 11e1b876c..b5bea4224 100644 --- a/stdlib/source/test/lux/control/function/memo.lux +++ b/stdlib/source/test/lux/control/function/memo.lux @@ -46,10 +46,10 @@ (def: milli_seconds (-> Duration Nat) - (|>> (duration.query duration.milli_second) .nat)) + (|>> (duration.ticks duration.milli_second) .nat)) -## the wiggle room is there to account for GC pauses -## and other issues that might mess with duration +... the wiggle room is there to account for GC pauses +... and other issues that might mess with duration (def: wiggle_room Nat (i64.left_shifted 4 1)) diff --git a/stdlib/source/test/lux/control/parser/binary.lux b/stdlib/source/test/lux/control/parser/binary.lux index bbba888a7..e86718715 100644 --- a/stdlib/source/test/lux/control/parser/binary.lux +++ b/stdlib/source/test/lux/control/parser/binary.lux @@ -270,7 +270,7 @@ [/.set (/.set n.hash /.nat) format.set (format.set format.nat) (random.set n.hash ..segment_size random.nat) set.equivalence] [/.name /.name format.name format.name ..random_name name.equivalence])) (do {! random.monad} - [expected (\ ! map (list.repeat ..segment_size) random.nat)] + [expected (\ ! map (list.repeated ..segment_size) random.nat)] (_.cover [/.set_elements_are_not_unique] (|> expected (format.run (format.list format.nat)) diff --git a/stdlib/source/test/lux/control/parser/xml.lux b/stdlib/source/test/lux/control/parser/xml.lux index 6269cafd5..81c4da80d 100644 --- a/stdlib/source/test/lux/control/parser/xml.lux +++ b/stdlib/source/test/lux/control/parser/xml.lux @@ -163,14 +163,14 @@ (_.cover [/.somewhere] (|> (/.run parser (list (node parent - (list.concat (list (list.repeat repetitions (node wrong (list))) + (list.concat (list (list.repeated repetitions (node wrong (list))) (list (node right (list))) - (list.repeat repetitions (node wrong (list)))))))) + (list.repeated repetitions (node wrong (list)))))))) (!expect (#try.Success [])))) (_.cover [/.nowhere] (|> (/.run parser (list (node parent - (list.repeat repetitions (node wrong (list)))))) + (list.repeated repetitions (node wrong (list)))))) (!expect (^multi (#try.Failure error) (exception.match? /.nowhere error))))) )) diff --git a/stdlib/source/test/lux/data.lux b/stdlib/source/test/lux/data.lux index d350cabf9..beb1ee201 100644 --- a/stdlib/source/test/lux/data.lux +++ b/stdlib/source/test/lux/data.lux @@ -25,7 +25,7 @@ ["#/." xml]] ["#." collection]]) -## TODO: Get rid of this ASAP +... TODO: Get rid of this ASAP (template: (!bundle body) [(: Test (do random.monad @@ -66,7 +66,7 @@ (def: .public test Test - ## TODO: Inline ASAP + ... TODO: Inline ASAP ($_ _.and (!bundle test/0) (!bundle test/1) diff --git a/stdlib/source/test/lux/data/binary.lux b/stdlib/source/test/lux/data/binary.lux index 3326d0055..b7ae6bba4 100644 --- a/stdlib/source/test/lux/data/binary.lux +++ b/stdlib/source/test/lux/data/binary.lux @@ -38,7 +38,7 @@ (if (n.< size idx) (do random.monad [byte random.nat] - (exec (try.assumed (/.write/8 idx byte output)) + (exec (try.assumed (/.write/8! idx byte output)) (recur (inc idx)))) (\ random.monad in output))))) @@ -104,14 +104,14 @@ (|> (/.create size) /.size (n.= size))) (_.for [/.index_out_of_bounds] ($_ _.and - (_.cover [/.read/8 /.write/8] - (..binary_io 0 /.read/8 /.write/8 value)) - (_.cover [/.read/16 /.write/16] - (..binary_io 1 /.read/16 /.write/16 value)) - (_.cover [/.read/32 /.write/32] - (..binary_io 2 /.read/32 /.write/32 value)) - (_.cover [/.read/64 /.write/64] - (..binary_io 3 /.read/64 /.write/64 value)))) + (_.cover [/.read/8! /.write/8!] + (..binary_io 0 /.read/8! /.write/8! value)) + (_.cover [/.read/16! /.write/16!] + (..binary_io 1 /.read/16! /.write/16! value)) + (_.cover [/.read/32! /.write/32!] + (..binary_io 2 /.read/32! /.write/32! value)) + (_.cover [/.read/64! /.write/64!] + (..binary_io 3 /.read/64! /.write/64! value)))) (_.cover [/.slice] (let [random_slice (try.assumed (/.slice offset length sample)) idxs (: (List Nat) @@ -119,7 +119,7 @@ 0 (list) _ (enum.range n.enum 0 (dec length)))) reader (function (_ binary idx) - (/.read/8 idx binary))] + (/.read/8! idx binary))] (and (n.= length (/.size random_slice)) (case [(monad.map try.monad (|>> (n.+ offset) (reader sample)) idxs) (monad.map try.monad (reader random_slice) idxs)] @@ -154,10 +154,10 @@ false) (succeed (do try.monad - [sample/0 (/.read/8 0 sample) + [sample/0 (/.read/8! 0 sample) copy (/.copy 1 0 sample 0 (/.create 2)) - copy/0 (/.read/8 0 copy) - copy/1 (/.read/8 1 copy)] + copy/0 (/.read/8! 0 copy) + copy/1 (/.read/8! 1 copy)] (in (and (n.= sample/0 copy/0) (n.= 0 copy/1))))))) ))))) diff --git a/stdlib/source/test/lux/data/collection/list.lux b/stdlib/source/test/lux/data/collection/list.lux index ee6b9e7cb..abf61aef3 100644 --- a/stdlib/source/test/lux/data/collection/list.lux +++ b/stdlib/source/test/lux/data/collection/list.lux @@ -96,8 +96,8 @@ (\ bit.equivalence = (/.empty? sample) (n.= 0 (/.size sample)))) - (_.cover [/.repeat] - (n.= size (/.size (/.repeat size [])))) + (_.cover [/.repeated] + (n.= size (/.size (/.repeated size [])))) (_.cover [/.reversed] (or (n.< 2 (/.size sample)) (let [not_same! diff --git a/stdlib/source/test/lux/data/collection/sequence.lux b/stdlib/source/test/lux/data/collection/sequence.lux index c94b19ac6..7485d857c 100644 --- a/stdlib/source/test/lux/data/collection/sequence.lux +++ b/stdlib/source/test/lux/data/collection/sequence.lux @@ -43,16 +43,16 @@ cycle_next (random.list size random.nat)] ($_ _.and (_.for [/.functor] - ($functor.spec /.repeat ..equivalence /.functor)) + ($functor.spec /.repeated ..equivalence /.functor)) (_.for [/.comonad] - ($comonad.spec /.repeat ..equivalence /.comonad)) + ($comonad.spec /.repeated ..equivalence /.comonad)) (_.cover [/.iterations /.item] (n.= (n.+ offset index) (/.item index (/.iterations inc offset)))) - (_.cover [/.repeat] + (_.cover [/.repeated] (n.= repeated - (/.item index (/.repeat repeated)))) + (/.item index (/.repeated repeated)))) (_.cover [/.take] (list\= (enum.range n.enum offset (dec (n.+ size offset))) (/.take size (/.iterations inc offset)))) @@ -103,7 +103,7 @@ offset))))) (_.cover [/.cycle] (let [cycle (list& cycle_start cycle_next)] - (list\= (list.concat (list.repeat size cycle)) + (list\= (list.concat (list.repeated size cycle)) (/.take (n.* size (list.size cycle)) (/.cycle [cycle_start cycle_next]))))) (_.cover [/.^sequence&] diff --git a/stdlib/source/test/lux/data/color/named.lux b/stdlib/source/test/lux/data/color/named.lux index 7f8c959b9..6d0130db6 100644 --- a/stdlib/source/test/lux/data/color/named.lux +++ b/stdlib/source/test/lux/data/color/named.lux @@ -21,7 +21,7 @@ (with_expansions [ (as_is [letter/a [/.alice_blue /.antique_white - ## /.aqua + ... /.aqua /.aquamarine /.azure]] @@ -72,7 +72,7 @@ [/.fire_brick /.floral_white /.forest_green - ## /.fuchsia + ... /.fuchsia ]] [letter/g diff --git a/stdlib/source/test/lux/data/format/tar.lux b/stdlib/source/test/lux/data/format/tar.lux index 4ccec923b..c951382ba 100644 --- a/stdlib/source/test/lux/data/format/tar.lux +++ b/stdlib/source/test/lux/data/format/tar.lux @@ -163,7 +163,7 @@ chunk (random.ascii/lower chunk_size) chunks (\ ! map (n.% 100) random.nat) .let [content (|> chunk - (list.repeat chunks) + (list.repeated chunks) (text.join_with "") (\ utf8.codec encode))]] (`` ($_ _.and @@ -206,7 +206,7 @@ (in (case (row.list tar) (^ (list ( [actual_path actual_moment actual_mode actual_ownership actual_content]))) (let [seconds (: (-> Instant Int) - (|>> instant.relative (duration.query duration.second)))] + (|>> instant.relative (duration.ticks duration.second)))] (and (text\= (/.from_path expected_path) (/.from_path actual_path)) (i.= (seconds expected_moment) diff --git a/stdlib/source/test/lux/data/name.lux b/stdlib/source/test/lux/data/name.lux index 01d5131c8..2cde215a0 100644 --- a/stdlib/source/test/lux/data/name.lux +++ b/stdlib/source/test/lux/data/name.lux @@ -29,11 +29,11 @@ Test (<| (_.covering /._) (do {! random.monad} - [## First Name + [... First Name sizeM1 (|> random.nat (\ ! map (n.% 100))) sizeS1 (|> random.nat (\ ! map (|>> (n.% 100) (n.max 1)))) (^@ name1 [module1 short1]) (..random sizeM1 sizeS1) - ## Second Name + ... Second Name sizeM2 (|> random.nat (\ ! map (n.% 100))) sizeS2 (|> random.nat (\ ! map (|>> (n.% 100) (n.max 1)))) (^@ name2 [module2 short2]) (..random sizeM2 sizeS2)] diff --git a/stdlib/source/test/lux/data/text.lux b/stdlib/source/test/lux/data/text.lux index ca7f2f69f..4ff904116 100644 --- a/stdlib/source/test/lux/data/text.lux +++ b/stdlib/source/test/lux/data/text.lux @@ -204,10 +204,10 @@ (\ /.equivalence = (/.concat (set.list characters)) (/.join_with "" (set.list characters))))) - (_.cover [/.replace_once] + (_.cover [/.replaced/1] (\ /.equivalence = (\ /.monoid compose post static) - (/.replace_once pre post (\ /.monoid compose pre static)))) + (/.replaced/1 pre post (\ /.monoid compose pre static)))) (_.cover [/.split_with] (case (/.split_with static ($_ (\ /.monoid compose) pre static post)) (#.Some [left right]) @@ -314,9 +314,9 @@ (do {! random.monad} [sizeP bounded_size sizeL bounded_size - .let [## The wider unicode charset includes control characters that - ## can make text replacement work improperly. - ## Because of that, I restrict the charset. + .let [... The wider unicode charset includes control characters that + ... can make text replacement work improperly. + ... Because of that, I restrict the charset. normal_char_gen (|> random.nat (\ ! map (|>> (n.% 128) (n.max 1))))] sep1 (random.text normal_char_gen 1) sep2 (random.text normal_char_gen 1) @@ -326,9 +326,9 @@ .let [sample1 (/.concat (list.interpose sep1 parts)) sample2 (/.concat (list.interpose sep2 parts)) (^open "/\.") /.equivalence]] - (_.cover [/.replace_all] + (_.cover [/.replaced] (/\= sample2 - (/.replace_all sep1 sep2 sample1)))) + (/.replaced sep1 sep2 sample1)))) /buffer.test /encoding.test diff --git a/stdlib/source/test/lux/data/text/escape.lux b/stdlib/source/test/lux/data/text/escape.lux index 3b320fd90..35dfaf1cf 100644 --- a/stdlib/source/test/lux/data/text/escape.lux +++ b/stdlib/source/test/lux/data/text/escape.lux @@ -76,8 +76,8 @@ (random.ascii 10))]] (in (list (code.text expected))))) -(syntax: (static_escape {un_escaped .text}) - (in (list (code.text (/.escape un_escaped))))) +(syntax: (static_escaped {un_escaped .text}) + (in (list (code.text (/.escaped un_escaped))))) (def: .public test Test @@ -99,24 +99,24 @@ (do random.monad [left (random.char unicode.character) right (random.char unicode.character)] - (_.cover [/.escape /.un_escape] + (_.cover [/.escaped /.un_escaped] (let [expected (format (text.of_char left) (text.of_char right))] (if (or (/.escapable? left) (/.escapable? right)) - (let [escaped (/.escape expected)] - (case (/.un_escape escaped) + (let [escaped (/.escaped expected)] + (case (/.un_escaped escaped) (#try.Success un_escaped) (and (not (text\= escaped expected)) (text\= un_escaped expected)) (#try.Failure error) false)) - (text\= expected (/.escape expected)))))) + (text\= expected (/.escaped expected)))))) (do {! random.monad} [dummy (|> (random.char unicode.character) (\ ! map text.of_char))] (_.cover [/.dangling_escape] - (case (/.un_escape (format (/.escape dummy) "\")) + (case (/.un_escaped (format (/.escaped dummy) "\")) (#try.Success _) false @@ -127,7 +127,7 @@ (random.only (|>> (set.member? ..valid_sigils) not)) (\ ! map text.of_char))] (_.cover [/.invalid_escape] - (case (/.un_escape (format "\" dummy)) + (case (/.un_escaped (format "\" dummy)) (#try.Success _) false @@ -143,7 +143,7 @@ (#try.Success _) false))))] (_.cover [/.invalid_unicode_escape] (template.let [(!invalid ) - [(case (/.un_escape (format "\u" )) + [(case (/.un_escaped (format "\u" )) (#try.Success _) false @@ -151,7 +151,7 @@ (exception.match? /.invalid_unicode_escape error))]] (and (!invalid (\ n.hex encode too_short)) (!invalid code))))) - (_.cover [/.escaped] + (_.cover [/.literal] (with_expansions [ (..static_sample)] - (text\= (`` (/.escaped (~~ (..static_escape ))))))) + (text\= (`` (/.literal (~~ (..static_escaped ))))))) ))) diff --git a/stdlib/source/test/lux/data/text/unicode/block.lux b/stdlib/source/test/lux/data/text/unicode/block.lux index 4f92f8db9..6cdc5f091 100644 --- a/stdlib/source/test/lux/data/text/unicode/block.lux +++ b/stdlib/source/test/lux/data/text/unicode/block.lux @@ -141,7 +141,7 @@ /.halfwidth_and_fullwidth_forms /.specials - ## Specialized blocks + ... Specialized blocks /.basic_latin/decimal /.basic_latin/upper /.basic_latin/lower]] diff --git a/stdlib/source/test/lux/debug.lux b/stdlib/source/test/lux/debug.lux index 8d9a9ef4c..7d7f7cf64 100644 --- a/stdlib/source/test/lux/debug.lux +++ b/stdlib/source/test/lux/debug.lux @@ -85,20 +85,20 @@ (#try.Failure error) false) - ## TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants - ## (~~ (template [ ] - ## [(|> (/.representation (type (Or Bit Int Frac)) - ## (: (Or Bit Int Frac) - ## ( ))) - ## (try\map (text\= (format "(" (%.nat ) - ## " " (%.bit ) - ## " " ( ) ")"))) - ## (try.else false))] + ... TODO: Uncomment after switching from the old (tag+last?) to the new (lefts+right?) representation for variants + ... (~~ (template [ ] + ... [(|> (/.representation (type (Or Bit Int Frac)) + ... (: (Or Bit Int Frac) + ... ( ))) + ... (try\map (text\= (format "(" (%.nat ) + ... " " (%.bit ) + ... " " ( ) ")"))) + ... (try.else false))] - ## [0 #0 sample_bit %.bit] - ## [1 #0 sample_int %.int] - ## [1 #1 sample_frac %.frac] - ## )) + ... [0 #0 sample_bit %.bit] + ... [1 #0 sample_int %.int] + ... [1 #1 sample_frac %.frac] + ... )) ))))) (def: can_represent_complex_types diff --git a/stdlib/source/test/lux/extension.lux b/stdlib/source/test/lux/extension.lux index 117fd784a..e28e013cc 100644 --- a/stdlib/source/test/lux/extension.lux +++ b/stdlib/source/test/lux/extension.lux @@ -50,16 +50,16 @@ (def: dummy_generation "dummy generation") (def: my_directive "my directive") -## Generation +... Generation (for {@.old (as_is)} (as_is - ## Analysis + ... Analysis (analysis: (..my_analysis self phase archive {pass_through .any}) (phase archive pass_through)) - ## Synthesis + ... Synthesis (analysis: (..my_synthesis self phase archive {parameters (<>.some .any)}) (let [! phase.monad] (|> parameters @@ -69,7 +69,7 @@ (synthesis: (..my_synthesis self phase archive {pass_through .any}) (phase archive pass_through)) - ## Generation + ... Generation (analysis: (..my_generation self phase archive {parameters (<>.some .any)}) (let [! phase.monad] (|> parameters @@ -106,7 +106,7 @@ @.php (php.string self) @.scheme (scheme.string self)}))) - ## Directive + ... Directive (directive: (..my_directive self phase archive {parameters (<>.some .any)}) (do phase.monad [.let [_ (debug.log! (format "Successfully installed directive " (%.text self) "!"))]] diff --git a/stdlib/source/test/lux/ffi.js.lux b/stdlib/source/test/lux/ffi.js.lux index 2ba2c8f7a..994430c85 100644 --- a/stdlib/source/test/lux/ffi.js.lux +++ b/stdlib/source/test/lux/ffi.js.lux @@ -19,19 +19,19 @@ (/.import: Uint8Array) -## On Nashorn +... On Nashorn (/.import: java/lang/String ["#::." (new [Uint8Array /.String]) (getBytes [/.String] Uint8Array)]) -## On Node +... On Node (/.import: Buffer ["#::." (#static from [/.String /.String] Buffer) (toString [/.String] /.String)]) -## On the browser +... On the browser (/.import: TextEncoder ["#::." (new [/.String]) @@ -52,7 +52,7 @@ (: (-> Nat Nat) (nat.+ shift))) random.nat) - ## I64s get compiled as JavaScript objects with a specific structure. + ... I64s get compiled as JavaScript objects with a specific structure. object random.nat] (<| (_.covering /._) (`` ($_ _.and @@ -132,7 +132,7 @@ (|> (Buffer::from [string encoding]) (Buffer::toString [encoding])) - ## On the browser + ... On the browser (let [binary (|> (TextEncoder::new [encoding]) (TextEncoder::encode [string]))] (|> (TextDecoder::new [encoding]) diff --git a/stdlib/source/test/lux/ffi.jvm.lux b/stdlib/source/test/lux/ffi.jvm.lux index b393d363b..6b03ebc15 100644 --- a/stdlib/source/test/lux/ffi.jvm.lux +++ b/stdlib/source/test/lux/ffi.jvm.lux @@ -339,12 +339,12 @@ example/4!)))) (/.class: #final test/TestClass0 [test/TestInterface0] - ## Fields + ... Fields (#private value java/lang/Long) - ## Constructors + ... Constructors (#public [] (new self {value java/lang/Long}) [] (:= ::value value)) - ## Methods + ... Methods (test/TestInterface0 [] (actual0 self) java/lang/Long ::value)) @@ -353,12 +353,12 @@ (new [java/lang/Long])]) (/.class: #final test/TestClass1 [test/TestInterface1] - ## Fields + ... Fields (#private value java/lang/Long) - ## Constructors + ... Constructors (#public [] (new self {value java/lang/Long}) [] (:= ::value value)) - ## Methods + ... Methods (test/TestInterface1 [] (actual1 self {throw? java/lang/Boolean}) java/lang/Long #throws [java/lang/Throwable] (if (:as Bit throw?) (error! "YOLO") @@ -369,10 +369,10 @@ (new [java/lang/Long])]) (/.class: #final test/TestClass2 [test/TestInterface2] - ## Constructors + ... Constructors (#public [] (new self) [] []) - ## Methods + ... Methods (test/TestInterface2 [a] (actual2 self {input a}) a @@ -383,12 +383,12 @@ (new [])]) (/.class: #final (test/TestClass3 a) [(test/TestInterface3 a)] - ## Fields + ... Fields (#private value a) - ## Constructors + ... Constructors (#public [] (new self {value a}) [] (:= ::value value)) - ## Methods + ... Methods ((test/TestInterface3 a) [] (actual3 self) a @@ -399,10 +399,10 @@ (new [a])]) (/.class: #final test/TestClass4 [] - ## Constructors + ... Constructors (#public [] (new self) [] []) - ## Methods + ... Methods (#public (actual4 self {value java/lang/Long}) java/lang/Long value)) @@ -412,10 +412,10 @@ (actual4 [java/lang/Long] java/lang/Long)]) (/.class: #final test/TestClass5 [] - ## Constructors + ... Constructors (#public [] (new self) [] []) - ## Methods + ... Methods (#public #static (actual5 {value java/lang/Long}) java/lang/Long value)) @@ -425,10 +425,10 @@ (#static actual5 [java/lang/Long] java/lang/Long)]) (/.class: #abstract test/TestClass6 [] - ## Constructors + ... Constructors (#public [] (new self) [] []) - ## Methods + ... Methods (#public #abstract (actual6 {value java/lang/Long}) java/lang/Long)) @@ -437,10 +437,10 @@ (actual6 [java/lang/Long] java/lang/Long)]) (/.class: #final test/TestClass7 test/TestClass6 [] - ## Constructors + ... Constructors (#public [] (new self) [] []) - ## Methods + ... Methods (test/TestClass6 [] (actual6 self {input java/lang/Long}) java/lang/Long @@ -451,10 +451,10 @@ (new [])]) (/.class: #final test/TestClass8 [test/TestInterface4] - ## Constructors + ... Constructors (#public [] (new self) [] []) - ## Methods + ... Methods (test/TestInterface4 [] (actual4 self {actual_left long} {actual_right long} {_ long}) long @@ -467,12 +467,12 @@ (new [])]) (/.class: #final (test/TestClass9 a) [] - ## Fields + ... Fields (#private value9 a) - ## Constructors + ... Constructors (#public [] (new self {value a}) [] (:= ::value9 value)) - ## Methods + ... Methods (#public (set_actual9 self {value a}) void (:= ::value9 value)) (#public (get_actual9 self) a diff --git a/stdlib/source/test/lux/ffi.old.lux b/stdlib/source/test/lux/ffi.old.lux index 7e9301b30..9ca7d80b3 100644 --- a/stdlib/source/test/lux/ffi.old.lux +++ b/stdlib/source/test/lux/ffi.old.lux @@ -34,10 +34,10 @@ (getName [] java/lang/String)]) (/.class: #final (TestClass A) [] - ## Fields + ... Fields (#private increase java/lang/Long) (#private counter java/lang/Long) - ## Methods + ... Methods (#public [] (new {increase java/lang/Long} {counter java/lang/Long}) [] (exec (:= ::increase increase) diff --git a/stdlib/source/test/lux/locale/language.lux b/stdlib/source/test/lux/locale/language.lux index 09f2bfc52..d40c628c7 100644 --- a/stdlib/source/test/lux/locale/language.lux +++ b/stdlib/source/test/lux/locale/language.lux @@ -219,22 +219,22 @@ (def: aliases_test/0 Test ($_ _.and - ## A + ... A (!aliases /.official_aramaic [/.imperial_aramaic]) (!aliases /.asturian [/.bable /.leonese /.asturleonese]) - ## B + ... B (!aliases /.bini [/.edo]) (!aliases /.blin [/.bilin]) - ## C + ... C (!aliases /.catalan [/.valencian]) (!aliases /.church_slavic [/.old_slavonic /.church_slavonic /.old_bulgarian /.old_church_slavonic]) - ## D + ... D (!aliases /.dhivehi [/.maldivian]) - ## G + ... G (!aliases /.swiss_german [/.alemannic /.alsatian]) - ## I + ... I (!aliases /.sichuan_yi [/.nuosu]) - ## K + ... K (!aliases /.kachin [/.jingpho]) (!aliases /.kalaallisut [/.greenlandic]) (!aliases /.khotanese [/.sakan]) @@ -243,27 +243,27 @@ (def: aliases_test/1 Test ($_ _.and - ## M + ... M (!aliases /.mi'kmaq [/.micmac]) - ## N + ... N (!aliases /.newari [/.nepal_bhasa]) (!aliases /.dutch [/.flemish]) (!aliases /.northern_sotho [/.pedi /.sepedi]) (!aliases /.old_newari [/.classical_newari /.classical_nepal_bhasa]) (!aliases /.nyanja [/.chichewa /.chewa]) - ## O + ... O (!aliases /.occitan [/.provencal]) - ## P + ... P (!aliases /.pampanga [/.kapampangan]) - ## R + ... R (!aliases /.rarotongan [/.cook_islands_maori]) (!aliases /.romanian [/.moldavian /.moldovan]) (!aliases /.aromanian [/.arumanian /.macedo_romanian]) - ## S + ... S (!aliases /.spanish [/.castilian]) - ## X + ... X (!aliases /.kalmyk [/.oirat]) - ## Z + ... Z (!aliases /.zaza [/.dimili /.dimli /.kirdki /.kirmanjki /.zazaki]) )) diff --git a/stdlib/source/test/lux/locale/territory.lux b/stdlib/source/test/lux/locale/territory.lux index 8f323004c..a5b5c4f61 100644 --- a/stdlib/source/test/lux/locale/territory.lux +++ b/stdlib/source/test/lux/locale/territory.lux @@ -176,14 +176,14 @@ (def: aliases_test Test ($_ _.and - ## A + ... A (!aliases /.antigua [/.barbuda]) - ## B + ... B (!aliases /.bonaire [/.sint_eustatius /.saba]) (!aliases /.bosnia [/.herzegovina]) - ## H + ... H (!aliases /.heard_island [/.mcdonald_islands]) - ## S + ... S (!aliases /.saint_helena [/.ascension /.tristan_da_cunha]) (!aliases /.saint_kitts [/.nevis]) (!aliases /.saint_pierre [/.miquelon]) @@ -191,12 +191,12 @@ (!aliases /.sao_tome [/.principe]) (!aliases /.south_georgia [/.south_sandwich_islands]) (!aliases /.svalbard [/.jan_mayen]) - ## T + ... T (!aliases /.trinidad [/.tobago]) (!aliases /.turks [/.caicos_islands]) - ## U + ... U (!aliases /.united_kingdom [/.northern_ireland]) - ## W + ... W (!aliases /.wallis [/.futuna]) )) diff --git a/stdlib/source/test/lux/macro.lux b/stdlib/source/test/lux/macro.lux index bbc60bf4a..7ff37ea43 100644 --- a/stdlib/source/test/lux/macro.lux +++ b/stdlib/source/test/lux/macro.lux @@ -48,8 +48,8 @@ (syntax: (pow/4 number) (in (list (` (..pow/2 (..pow/2 (~ number))))))) -(syntax: (repeat {times .nat} token) - (in (list.repeat times token))) +(syntax: (repeated {times .nat} token) + (in (list.repeated times token))) (syntax: (fresh_identifier) (do meta.monad @@ -89,7 +89,7 @@ #.definitions (: (List [Text .Global]) (list (!global ..pow/2) (!global ..pow/4) - (!global ..repeat))) + (!global ..repeated))) #.imports (list) #.tags (list) #.types (list) @@ -143,7 +143,7 @@ )) (_.cover [/.one_expansion] (bit\= (not (nat.= 1 repetitions)) - (|> (/.one_expansion (` (..repeat (~ (code.nat repetitions)) (~ pow/1)))) + (|> (/.one_expansion (` (..repeated (~ (code.nat repetitions)) (~ pow/1)))) (meta.run lux) (!expect (#try.Failure _))))) )))) diff --git a/stdlib/source/test/lux/macro/code.lux b/stdlib/source/test/lux/macro/code.lux index a5bb3a9e9..d0bd1343a 100644 --- a/stdlib/source/test/lux/macro/code.lux +++ b/stdlib/source/test/lux/macro/code.lux @@ -79,14 +79,14 @@ (#.Right [end lux_code]) (#try.Success lux_code)))) -(def: (replace_simulation [original substitute]) +(def: (replacement_simulation [original substitute]) (-> [Code Code] (Random [Code Code])) (random.rec - (function (_ replace_simulation) + (function (_ replacement_simulation) (let [for_sequence (: (-> (-> (List Code) Code) (Random [Code Code])) (function (_ to_code) (do {! random.monad} - [parts (..random_sequence replace_simulation)] + [parts (..random_sequence replacement_simulation)] (in [(to_code (list\map product.left parts)) (to_code (list\map product.right parts))]))))] ($_ random.either @@ -106,7 +106,7 @@ (for_sequence /.form) (for_sequence /.tuple) (do {! random.monad} - [parts (..random_sequence replace_simulation)] + [parts (..random_sequence replacement_simulation)] (in [(/.record (let [parts' (list\map product.left parts)] (list.zipped/2 parts' parts'))) (/.record (let [parts' (list\map product.right parts)] @@ -180,9 +180,9 @@ (random.and ..random ..random)) [sample expected] (random.only (function (_ [sample expected]) (not (\ /.equivalence = sample expected))) - (..replace_simulation [original substitute]))] - (_.cover [/.replace] + (..replacement_simulation [original substitute]))] + (_.cover [/.replaced] (\ /.equivalence = expected - (/.replace original substitute sample)))) + (/.replaced original substitute sample)))) ))) diff --git a/stdlib/source/test/lux/macro/poly/json.lux b/stdlib/source/test/lux/macro/poly/json.lux index fa8e6facb..b1b9883cb 100644 --- a/stdlib/source/test/lux/macro/poly/json.lux +++ b/stdlib/source/test/lux/macro/poly/json.lux @@ -15,7 +15,7 @@ pipe ["." try] ["p" parser - ## TODO: Get rid of this import ASAP + ... TODO: Get rid of this import ASAP [json (#+)]]] [data ["." bit] @@ -42,13 +42,13 @@ [time ["ti" instant] ["tda" date] - ## ["tdu" duration] + ... ["tdu" duration] ]]] [test [lux [time ["_." instant] - ## ["_." duration] + ... ["_." duration] ]]]) (type: Variant @@ -70,8 +70,8 @@ #variant Variant #tuple [Bit Text Frac] #recursive Recursive - ## #instant ti.Instant - ## #duration tdu.Duration + ... #instant ti.Instant + ... #duration tdu.Duration #date tda.Date #grams (unit.Qty unit.Gram)}) @@ -101,8 +101,8 @@ ($_ random.or random.bit (random.unicode size) random.safe_frac) ($_ random.and random.bit (random.unicode size) random.safe_frac) ..gen_recursive - ## _instant.instant - ## _duration.duration + ... _instant.instant + ... _duration.duration random.date ..qty ))) diff --git a/stdlib/source/test/lux/macro/syntax/export.lux b/stdlib/source/test/lux/macro/syntax/export.lux index adb95407f..58d8b50a5 100644 --- a/stdlib/source/test/lux/macro/syntax/export.lux +++ b/stdlib/source/test/lux/macro/syntax/export.lux @@ -5,26 +5,44 @@ [abstract [monad (#+ do)]] [control - ["." try] + ["." try ("#\." functor)] [parser ["<.>" code]]] [data - ["." bit ("#\." equivalence)]] + ["." maybe]] + [macro + ["." code ("#\." equivalence)]] [math - ["." random]]]] + ["." random (#+ Random)] + [number + ["n" nat]]]]] [\\library ["." /]]) +(def: export + (Random [(Maybe Code) Nat]) + ($_ random.and + (|> random.bit + (\ random.monad map code.bit) + random.maybe) + random.nat)) + (def: .public test Test (<| (_.covering /._) (do random.monad - [expected random.bit] - (_.cover [/.format /.parser] - (case (.run /.parser - (/.format expected)) - (#try.Failure _) - false - - (#try.Success actual) - (bit\= expected actual)))))) + [[expected_export_policy expected_un_exported] ..export] + (_.cover [/.parser /.default_policy] + (|> (case expected_export_policy + (#.Some expected_export_policy) + (list expected_export_policy (code.nat expected_un_exported)) + + #.None + (list (code.nat expected_un_exported))) + (.run (/.parser .nat)) + (try\map (function (_ [actual_export_policy actual_un_exported]) + (|> expected_export_policy + (maybe.else /.default_policy) + (code\= actual_export_policy) + (and (n.= expected_un_exported actual_un_exported))))) + (try.else false)))))) diff --git a/stdlib/source/test/lux/math/number.lux b/stdlib/source/test/lux/math/number.lux index d97c73f45..8a298338f 100644 --- a/stdlib/source/test/lux/math/number.lux +++ b/stdlib/source/test/lux/math/number.lux @@ -26,7 +26,7 @@ (def: clean_commas (-> Text Text) - (text.replace_all "," "")) + (text.replaced "," "")) (def: .public test Test diff --git a/stdlib/source/test/lux/math/number/complex.lux b/stdlib/source/test/lux/math/number/complex.lux index 25bdc1216..77cafc155 100644 --- a/stdlib/source/test/lux/math/number/complex.lux +++ b/stdlib/source/test/lux/math/number/complex.lux @@ -21,7 +21,7 @@ ["f" frac] ["." int]]]]) -## This margin of error is necessary because floating-point arithmetic is not exact. +... This margin of error is necessary because floating-point arithmetic is not exact. (def: margin_of_error +0.000000001) @@ -115,7 +115,7 @@ (and normal! not_a_number! infinity!))) - ## https://en.wikipedia.org/wiki/Argument_(complex_analysis)#Identities + ... https://en.wikipedia.org/wiki/Argument_(complex_analysis)#Identities (_.cover [/.argument] (let [sample (/.complex real imaginary)] (or (/.= /.zero sample) @@ -188,7 +188,7 @@ (and reciprocal! own_inverse!))) (_.cover [/.signum] - ## Absolute value of signum is always root/2(2), 1 or 0. + ... Absolute value of signum is always root/2(2), 1 or 0. (let [signum_abs (|> x /.signum /.abs)] (or (f.= +0.0 signum_abs) (f.= +1.0 signum_abs) diff --git a/stdlib/source/test/lux/math/number/i64.lux b/stdlib/source/test/lux/math/number/i64.lux index 3504af6f7..9e9228ab6 100644 --- a/stdlib/source/test/lux/math/number/i64.lux +++ b/stdlib/source/test/lux/math/number/i64.lux @@ -105,15 +105,15 @@ (case size 0 (\= /.false (/.region offset size)) _ (\= (|> pattern - ## NNNNYYYYNNNN + ... NNNNYYYYNNNN (/.right_shifted offset) - ## ____NNNNYYYY + ... ____NNNNYYYY (/.left_shifted spare) - ## YYYY________ + ... YYYY________ (/.right_shifted spare) - ## ________YYYY + ... ________YYYY (/.left_shifted offset) - ## ____YYYY____ + ... ____YYYY____ ) (/.and (/.region offset size) pattern))))) )))) diff --git a/stdlib/source/test/lux/target/jvm.lux b/stdlib/source/test/lux/target/jvm.lux index e6cfcf082..dfe6180ab 100644 --- a/stdlib/source/test/lux/target/jvm.lux +++ b/stdlib/source/test/lux/target/jvm.lux @@ -504,7 +504,7 @@ (i.> (:as Int reference) (:as Int subject)) (:as java/lang/Long +1) - ## (i.< (:as Int reference) (:as Int subject)) + ... (i.< (:as Int reference) (:as Int subject)) (:as java/lang/Long -1))]] (<| (..bytecode (for {@.old (|>> (:as Int) (i.= expected)) @@ -704,7 +704,7 @@ _ instruction _ /.i2l] ..$Long::wrap))))) - ## https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.dcmp_op + ... https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-6.html#jvms-6.5.dcmp_op comparison_standard (: (-> java/lang/Double java/lang/Double Bit) (function (_ reference subject) (for {@.old @@ -1485,7 +1485,7 @@ @wrong /.new_label @return /.new_label _ (/.bipush (|> minimum /signed.value .int /signed.s1 try.assumed)) - _ (/.tableswitch minimum @wrong [@right (list.repeat afterwards @wrong)]) + _ (/.tableswitch minimum @wrong [@right (list.repeated afterwards @wrong)]) _ (/.set_label @wrong) _ (..$Long::literal dummy) _ (/.goto @return) diff --git a/stdlib/source/test/lux/test.lux b/stdlib/source/test/lux/test.lux index 574feb176..0df2e43d3 100644 --- a/stdlib/source/test/lux/test.lux +++ b/stdlib/source/test/lux/test.lux @@ -105,11 +105,11 @@ times_assertion (<| (/.times expected) (do ! [_ (in []) - .let [_ (io.run (atom.update inc counter))]] + .let [_ (io.run (atom.update! inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] times_assertion - actual (async.future (atom.read counter))] + actual (async.future (atom.read! counter))] (/.cover' [/.times] (and (n.= expected actual) (n.= 1 (get@ #/.successes tally)) @@ -124,15 +124,15 @@ .let [counter (: (Atom Nat) (atom.atom 0))] assertion (<| /.in_parallel - (list.repeat expected) + (list.repeated expected) (: /.Test) (do ! [_ (in []) - .let [_ (io.run (atom.update inc counter))]] + .let [_ (io.run (atom.update! inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] assertion - actual (async.future (atom.read counter))] + actual (async.future (atom.read! counter))] (/.cover' [/.in_parallel] (and (n.= expected actual) (n.= expected (get@ #/.successes tally)) @@ -142,16 +142,16 @@ .let [counter (: (Atom Nat) (atom.atom 0))] assertion (<| /.in_parallel - (list.repeat expected) + (list.repeated expected) (: /.Test) (do ! [_ (in []) .let [_ (undefined) - _ (io.run (atom.update inc counter))]] + _ (io.run (atom.update! inc counter))]] (/.test "" true)))] (in (do async.monad [[tally error] assertion - actual (async.future (atom.read counter))] + actual (async.future (atom.read! counter))] (/.cover' [/.error_during_execution] (let [correct_error! (text.contains? (get@ #exception.label /.error_during_execution) error) no_complete_run! (n.= 0 actual) diff --git a/stdlib/source/test/lux/time/duration.lux b/stdlib/source/test/lux/time/duration.lux index b43ef18bd..f522dc613 100644 --- a/stdlib/source/test/lux/time/duration.lux +++ b/stdlib/source/test/lux/time/duration.lux @@ -79,13 +79,13 @@ (and (\< frame sample') (bit\= (\< frame sample) (\= sample sample'))))) - (_.cover [/.query] - (i.= +1 (/.query sample sample))) + (_.cover [/.ticks] + (i.= +1 (/.ticks sample sample))) (_.cover [/.milli_second] (\= /.empty (\ /.enum pred /.milli_second))) (~~ (template [ ] [(_.cover [] - (|> (/.query ) (i.= )))] + (|> (/.ticks ) (i.= )))] [+1,000 /.second /.milli_second] [+60 /.minute /.second] diff --git a/stdlib/source/test/lux/time/instant.lux b/stdlib/source/test/lux/time/instant.lux index c48ae6955..6e7c90821 100644 --- a/stdlib/source/test/lux/time/instant.lux +++ b/stdlib/source/test/lux/time/instant.lux @@ -73,7 +73,7 @@ (function (_ polarity move steps) (let [day_shift (list\fold (function.constant move) d0 - (list.repeat steps [])) + (list.repeated steps [])) instant_shift (|> instant (/.after (polarity (duration.up steps duration.day))) /.day_of_week)] diff --git a/stdlib/source/test/lux/time/month.lux b/stdlib/source/test/lux/time/month.lux index 03c50086f..18d56c088 100644 --- a/stdlib/source/test/lux/time/month.lux +++ b/stdlib/source/test/lux/time/month.lux @@ -77,13 +77,13 @@ (n.= all uniques)))) (_.cover [/.days] - (let [expected (.nat (duration.query duration.day duration.normal_year))] + (let [expected (.nat (duration.ticks duration.day duration.normal_year))] (|> /.year (list\map /.days) (list\fold n.+ 0) (n.= expected)))) (_.cover [/.leap_year_days] - (let [expected (.nat (duration.query duration.day duration.leap_year))] + (let [expected (.nat (duration.ticks duration.day duration.leap_year))] (|> /.year (list\map /.leap_year_days) (list\fold n.+ 0) diff --git a/stdlib/source/test/lux/time/year.lux b/stdlib/source/test/lux/time/year.lux index 366cc8bc2..82cdbf713 100644 --- a/stdlib/source/test/lux/time/year.lux +++ b/stdlib/source/test/lux/time/year.lux @@ -70,7 +70,7 @@ (#try.Failure error) (exception.match? /.there_is_no_year_0 error))) (_.cover [/.days] - (n.= (.nat (//duration.query //duration.day //duration.normal_year)) + (n.= (.nat (//duration.ticks //duration.day //duration.normal_year)) /.days)) (_.cover [/.epoch] (\ /.equivalence = diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux index 7a5b44f51..6d83f1fa7 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/case.lux @@ -131,12 +131,12 @@ (case member (#.Left lefts) (analysis.pattern/tuple - (list\compose (list.repeat lefts (analysis.pattern/unit)) + (list\compose (list.repeated lefts (analysis.pattern/unit)) (list inner (analysis.pattern/unit)))) (#.Right lefts) (analysis.pattern/tuple - (list\compose (list.repeat (inc lefts) (analysis.pattern/unit)) + (list\compose (list.repeated (inc lefts) (analysis.pattern/unit)) (list inner))))) (#analysis.Bind @member) (list.reversed path)) @@ -290,10 +290,10 @@ branch (: (-> Nat Bit Text Frac Branch) (function (_ lefts right? value body) {#analysis.when (if right? - (analysis.pattern/tuple (list\compose (list.repeat (inc lefts) (analysis.pattern/unit)) + (analysis.pattern/tuple (list\compose (list.repeated (inc lefts) (analysis.pattern/unit)) (list (analysis.pattern/text value)))) (analysis.pattern/tuple ($_ list\compose - (list.repeat lefts (analysis.pattern/unit)) + (list.repeated lefts (analysis.pattern/unit)) (list (analysis.pattern/text value) (analysis.pattern/unit))))) #analysis.then (analysis.frac body)}))]] diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux index 188c50a86..31e5e3422 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/phase/synthesis/function.lux @@ -230,7 +230,7 @@ #analysis.value (#analysis.Bind 2)}) #analysis.then actual_output} {#analysis.when (analysis.pattern/tuple - (list\compose (list.repeat lefts (analysis.pattern/unit)) + (list\compose (list.repeated lefts (analysis.pattern/unit)) (if right? (list (analysis.pattern/unit) (#analysis.Bind 2)) (list (#analysis.Bind 2) (analysis.pattern/unit))))) @@ -289,7 +289,7 @@ expected_record]) (#analysis.Case actual_record [{#analysis.when (analysis.pattern/tuple - (list\compose (list.repeat lefts (analysis.pattern/unit)) + (list\compose (list.repeated lefts (analysis.pattern/unit)) (if right? (list (analysis.pattern/unit) (#analysis.Bind 2)) (list (#analysis.Bind 2) (analysis.pattern/unit))))) diff --git a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux index e5a1e45d3..947170187 100644 --- a/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux +++ b/stdlib/source/test/lux/tool/compiler/language/lux/syntax.lux @@ -117,7 +117,7 @@ (Random Text) (do r.monad [comment comment_text^] - (in (format "## " comment text.new_line)))) + (in (format "... " comment text.new_line)))) (def: comments Test diff --git a/stdlib/source/test/lux/type.lux b/stdlib/source/test/lux/type.lux index 171f34873..5b2327dc4 100644 --- a/stdlib/source/test/lux/type.lux +++ b/stdlib/source/test/lux/type.lux @@ -10,10 +10,13 @@ [pipe (#+ case>)]] [data ["." maybe] + ["." bit ("#\." equivalence)] ["." text ("#\." equivalence)] [collection ["." list] ["." array]]] + [macro + ["." code ("#\." equivalence)]] [math ["." random (#+ Random) ("#\." monad)] [number @@ -92,7 +95,7 @@ _ #1))) - (list.repeat size) + (list.repeated size) (monad.seq !)) .let [(^open "/\.") /.equivalence (^open "list\.") (list.equivalence /.equivalence)]] @@ -118,7 +121,7 @@ (case> #.None #1 _ #0)))) (do {! random.monad} [size (|> random.nat (\ ! map (n.% 3))) - members (monad.seq ! (list.repeat size ..random)) + members (monad.seq ! (list.repeated size ..random)) extra (|> ..random (random.only (function (_ type) (case type @@ -218,6 +221,18 @@ (I64 a) (.i64 expected))))) + (do random.monad + [.let [(^open "/\.") /.equivalence] + left ..random + right ..random] + ($_ _.and + (_.cover [/.code] + (bit\= (/\= left right) + (code\= (/.code left) (/.code right)))) + (_.cover [/.format] + (bit\= (/\= left right) + (text\= (/.format left) (/.format right)))) + )) /abstract.test /check.test diff --git a/stdlib/source/test/lux/type/check.lux b/stdlib/source/test/lux/type/check.lux index eaa8cbb86..57df78e84 100644 --- a/stdlib/source/test/lux/type/check.lux +++ b/stdlib/source/test/lux/type/check.lux @@ -30,7 +30,7 @@ [\\library ["." /]]) -## TODO: Remove the following 3 definitions ASAP. //.type already exists... +... TODO: Remove the following 3 definitions ASAP. //.type already exists... (def: short (Random Text) (random.unicode 10)) @@ -421,7 +421,7 @@ (do ! [[id/T var/tail] /.var] (in var/tail))) - (list.repeat tail_size /.var)) + (list.repeated tail_size /.var)) var/last (monad.fold ! (function (_ var/next var/prev) (do ! [_ (/.check var/prev var/next)] @@ -582,7 +582,7 @@ (..succeeds? (/.check Any (#.Named right_name nominal))) (..succeeds? (/.check (#.Named left_name Any) (#.Named right_name nominal))))) -## TODO: Test all the crazy corner cases from /.check_apply +... TODO: Test all the crazy corner cases from /.check_apply (def: (handles_application! nominal/0 nominal/1) (-> Type Type Bit) (let [types_flow_through! diff --git a/stdlib/source/test/lux/type/dynamic.lux b/stdlib/source/test/lux/type/dynamic.lux index 04c25fb70..5a3e9e89d 100644 --- a/stdlib/source/test/lux/type/dynamic.lux +++ b/stdlib/source/test/lux/type/dynamic.lux @@ -24,15 +24,15 @@ (do random.monad [expected random.nat] ($_ _.and - (_.cover [/.:dynamic /.:check] - (case (/.:check Nat (/.:dynamic expected)) + (_.cover [/.:dynamic /.:static] + (case (/.:static Nat (/.:dynamic expected)) (#try.Success actual) (n.= expected actual) (#try.Failure _) false)) (_.cover [/.wrong_type] - (case (/.:check Text (/.:dynamic expected)) + (case (/.:static Text (/.:dynamic expected)) (#try.Success actual) false diff --git a/stdlib/source/test/lux/type/refinement.lux b/stdlib/source/test/lux/type/refinement.lux index da5826098..2c99f3163 100644 --- a/stdlib/source/test/lux/type/refinement.lux +++ b/stdlib/source/test/lux/type/refinement.lux @@ -17,7 +17,7 @@ ["." /]]) (def: _refiner - (/.refinement (n.> 123))) + (/.refiner (n.> 123))) (def: _type (/.type _refiner)) @@ -36,29 +36,29 @@ ($_ _.and (_.for [/.Refiner] ($_ _.and - (_.cover [/.refinement] - (case (/.refinement predicate raw) + (_.cover [/.refiner] + (case (/.refiner predicate raw) (#.Some refined) (predicate raw) #.None (not (predicate raw)))) (_.cover [/.predicate] - (|> (/.refinement predicate modulus) + (|> (/.refiner predicate modulus) (maybe\map (|>> /.predicate (is? predicate))) (maybe.else false))) )) (_.cover [/.value] - (|> (/.refinement predicate modulus) + (|> (/.refiner predicate modulus) (maybe\map (|>> /.value (n.= modulus))) (maybe.else false))) (_.cover [/.lift] - (and (|> (/.refinement predicate modulus) + (and (|> (/.refiner predicate modulus) (maybe\map (/.lift (n.+ modulus))) maybe\join (maybe\map (|>> /.value (n.= (n.+ modulus modulus)))) (maybe.else false)) - (|> (/.refinement predicate modulus) + (|> (/.refiner predicate modulus) (maybe\map (/.lift (n.+ (inc modulus)))) maybe\join (maybe\map (|>> /.value (n.= (n.+ modulus (inc modulus))))) @@ -66,7 +66,7 @@ not))) (_.cover [/.only] (let [expected (list.only predicate raws) - actual (/.only (/.refinement predicate) raws)] + actual (/.only (/.refiner predicate) raws)] (and (n.= (list.size expected) (list.size actual)) (\ (list.equivalence n.equivalence) = @@ -74,7 +74,7 @@ (list\map /.value actual))))) (_.cover [/.partition] (let [expected (list.only predicate raws) - [actual alternative] (/.partition (/.refinement predicate) raws)] + [actual alternative] (/.partition (/.refiner predicate) raws)] (and (n.= (list.size expected) (list.size actual)) (n.= (n.- (list.size expected) total_raws) diff --git a/stdlib/source/test/lux/world/file/watch.lux b/stdlib/source/test/lux/world/file/watch.lux index 6f70358e5..f3e0d7968 100644 --- a/stdlib/source/test/lux/world/file/watch.lux +++ b/stdlib/source/test/lux/world/file/watch.lux @@ -118,7 +118,7 @@ (def: (after_modification! fs watcher data expected_path) (-> (//.System Async) (/.Watcher Async) Binary //.Path (Async (Try Bit))) (do (try.with async.monad) - [_ (async.delay 1 (#try.Success "Delay to make sure the over_write time-stamp always changes.")) + [_ (async.delayed 1 (#try.Success "Delay to make sure the over_write time-stamp always changes.")) _ (\ fs write data expected_path) poll/2 (\ watcher poll []) poll/2' (\ watcher poll [])] diff --git a/stdlib/source/test/lux/world/shell.lux b/stdlib/source/test/lux/world/shell.lux index 3db61b469..4451f1f6f 100644 --- a/stdlib/source/test/lux/world/shell.lux +++ b/stdlib/source/test/lux/world/shell.lux @@ -44,7 +44,7 @@ (def: (on_error dead?) (if dead? (exception.except ..dead []) - (exception.return [dead? ""]))) + (#try.Success [dead? ""]))) (def: (on_write message dead?) (if dead? -- cgit v1.2.3