diff options
Diffstat (limited to '')
7 files changed, 124 insertions, 34 deletions
diff --git a/stdlib/source/test/aedifex.lux b/stdlib/source/test/aedifex.lux index 8b859955e..c9ce5c95e 100644 --- a/stdlib/source/test/aedifex.lux +++ b/stdlib/source/test/aedifex.lux @@ -59,5 +59,5 @@ (program args (<| io.io _.run! - (_.times 100) + (_.times 100 _.announce_success) ..test))) diff --git a/stdlib/source/test/aedifex/artifact.lux b/stdlib/source/test/aedifex/artifact.lux index 7e0d2c1cb..373393f2e 100644 --- a/stdlib/source/test/aedifex/artifact.lux +++ b/stdlib/source/test/aedifex/artifact.lux @@ -35,7 +35,8 @@ (all random.and (random.lower_cased size) (random.lower_cased size) - (random.lower_cased size)))) + (random.lower_cased size) + ))) (def .public test Test @@ -43,7 +44,9 @@ (do random.monad [sample ..random]) (_.for [/.Group /.Name /.Version - /.Artifact] + + /.Artifact + /.#group /.#name /.#version] (all _.and (_.for [/.equivalence] (equivalenceT.spec /.equivalence ..random)) diff --git a/stdlib/source/test/aedifex/dependency/deployment.lux b/stdlib/source/test/aedifex/dependency/deployment.lux index 3e7350050..9db5b07b5 100644 --- a/stdlib/source/test/aedifex/dependency/deployment.lux +++ b/stdlib/source/test/aedifex/dependency/deployment.lux @@ -26,11 +26,12 @@ ["n" nat]]] [world [net (.only URL) - ["[0]" uri (.only URI)] - ["[0]" http - ["[1]" client] - ["[1]/[0]" status] - ["@[1]" /]]]] + [uri (.only URI) + ["[0]" path]] + ["[0]" http (.only) + [response (.only Response)] + ["[0]" client (.only Client)] + ["[0]" status]]]] [test ["[0]" unit] ["_" property (.only Test)]]]] @@ -52,25 +53,25 @@ ["[0]" remote]]]]]]) (def good_upload - (@http.Response IO) - [http/status.created - [@http.#headers (http.headers (list)) - @http.#body (function (_ _) - (|> [0 (binary.empty 0)] - {try.#Success} - io.io))]]) + (Response IO) + [status.created + [http.#headers (client.headers (list)) + http.#body (function (_ _) + (|> [0 (binary.empty 0)] + {try.#Success} + io.io))]]) (type Cache (Atom (Dictionary URL Binary))) (def (http cache) - (-> Cache (http.Client IO)) + (-> Cache (Client IO)) (implementation (def (request method url headers input) (do io.monad [_ (is (IO Any) (when [method input] - [{@http.#Put} {.#Some input}] + [{http.#Put} {.#Some input}] (atom.update! (dictionary.has url input) cache) _ @@ -149,7 +150,7 @@ Test (<| (_.covering /._) (do [! random.monad] - [address (of ! each (text.suffix uri.separator) + [address (of ! each (text.suffix path.separator) (random.upper_cased 10))] (all _.and (do [! random.monad] diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index f61f1ec50..6b4f02130 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -7,11 +7,14 @@ ["[0]" monad (.only do)]] [control ["[0]" io] - ["[0]" try] - ["[0]" exception (.only Exception)]] + ["[0]" try (.only Try)] + ["[0]" exception (.only Exception)] + [concurrency + ["[0]" async (.only Async)]]] [data ["[0]" product] - ["[0]" binary (.only Binary)] + ["[0]" binary (.only Binary) + ["_[1]" \\test]] ["[0]" text (.only) ["%" \\format (.only format)]] [collection @@ -22,7 +25,8 @@ [net ["[0]" uri (.only URI)]]] [test - ["_" property (.only Test)]]]] + ["_" property (.only Test)] + ["[0]" unit]]]] ["[0]" / ["[1][0]" identity] ["[1][0]" origin] @@ -30,8 +34,6 @@ ["[1][0]" remote] [// ["@[0]" artifact]]] - [\\specification - ["$[0]" /]] [\\program ["[0]" / (.only) ["[0]" remote] @@ -39,6 +41,40 @@ ["[1][0]" artifact (.only Version Artifact) ["[1]/[0]" extension (.only Extension)]]]]]) +(def .public (spec valid_artifact invalid_artifact subject) + (-> Artifact Artifact (/.Repository Async) + Test) + (do random.monad + [expected (_binary.random 100)] + (in (all unit.and + (do async.monad + [.let [good_uri (remote.uri (the //artifact.#version valid_artifact) valid_artifact //artifact/extension.lux_library)] + good_upload! (of subject upload good_uri expected) + good_download! (of subject download good_uri) + + .let [bad_uri (remote.uri (the //artifact.#version invalid_artifact) invalid_artifact //artifact/extension.lux_library)] + bad_upload! (of subject upload bad_uri expected) + bad_download! (of subject download bad_uri)] + (unit.coverage [/.Repository] + (let [successfull_flow! + (when [good_upload! good_download!] + [{try.#Success _} {try.#Success actual}] + (of binary.equivalence = expected actual) + + _ + false) + + failed_flow! + (when [bad_upload! bad_download!] + [{try.#Failure _} {try.#Failure _}] + true + + _ + false)] + (and successfull_flow! + failed_flow!)))) + )))) + (def artifact (-> Version Artifact) (|>> ["com.github.luxlang" "test-artifact"])) @@ -94,14 +130,14 @@ (_.for [/.mock /.Mock] (do random.monad [_ (in [])] - ($/.spec (..artifact ..valid_version) - (..artifact ..invalid_version) - (/.mock ..mock - (|> ..empty - (dictionary.has (remote.uri ..invalid_version - (..artifact ..invalid_version) - //artifact/extension.lux_library) - (binary.empty 0))))))) + (..spec (..artifact ..valid_version) + (..artifact ..invalid_version) + (/.mock ..mock + (|> ..empty + (dictionary.has (remote.uri ..invalid_version + (..artifact ..invalid_version) + //artifact/extension.lux_library) + (binary.empty 0))))))) /identity.test /origin.test diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux index ce1def236..922290058 100644 --- a/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase.lux @@ -29,7 +29,8 @@ ["[1][0]" translation ["[1]/[0]" jvm ["[1]/[0]" host] - ["[1]/[0]" primitive]]]]) + ["[1]/[0]" primitive] + ["[1]/[0]" type]]]]) (def (injection value) (All (_ of) @@ -215,4 +216,5 @@ /translation/jvm/host.test /translation/jvm/primitive.test + /translation/jvm/type.test ))) diff --git a/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/type.lux b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/type.lux new file mode 100644 index 000000000..e99233eca --- /dev/null +++ b/stdlib/source/test/lux/meta/compiler/language/lux/phase/translation/jvm/type.lux @@ -0,0 +1,45 @@ +(.require + [library + [lux (.except Type) + [abstract + [monad (.only do)]] + [math + ["[0]" random (.only Random)]] + [meta + [target + [jvm + ["[0]" type (.only Type) (.use "[1]#[0]" equivalence) + [category (.only Primitive Array Class)]]]]] + [test + ["_" property (.only Test)]]]] + [\\library + ["[0]" /]]) + +(def .public test + Test + (<| (_.covering /._) + (do [! random.monad] + []) + (all _.and + (_.coverage [/.frac /.text] + (not (type#= /.frac /.text))) + (_.coverage [/.value /.error] + (not (type#= /.value /.error))) + (_.coverage [/.lefts] + (exec + (is (Type Primitive) + /.lefts) + true)) + (_.coverage [/.right?] + (exec + (is (Type Class) + /.right?) + true)) + (_.coverage [/.variant /.tuple] + (type#= /.variant /.tuple)) + (_.coverage [/.stack] + (exec + (is (Type Array) + /.stack) + true)) + ))) diff --git a/stdlib/source/test/lux/meta/compiler/meta/archive/artifact.lux b/stdlib/source/test/lux/meta/compiler/meta/archive/artifact.lux index b233a404b..7d5bba9e1 100644 --- a/stdlib/source/test/lux/meta/compiler/meta/archive/artifact.lux +++ b/stdlib/source/test/lux/meta/compiler/meta/archive/artifact.lux @@ -24,7 +24,10 @@ (def .public test Test (<| (_.covering /._) - (_.for [/.Artifact /.ID]) + (_.for [/.ID + + /.Artifact + /.#id /.#category /.#mandatory?]) (all _.and (_.for [/.equivalence] (equivalenceT.spec /.equivalence ..random)) |