diff options
author | Eduardo Julian | 2020-12-23 06:33:44 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-12-23 06:33:44 -0400 |
commit | d29e091e98dabb8dfcf816899ada480ecbf7e357 (patch) | |
tree | a9d34c7fbb700cdb0c1f1226d377150614ce9914 /stdlib/source/test/aedifex/repository | |
parent | cad959345afb8bf0bd1e5eefe6c63f136833b3ce (diff) |
Refactored "export" common syntax.
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/test/aedifex/repository.lux | 49 | ||||
-rw-r--r-- | stdlib/source/test/aedifex/repository/identity.lux | 30 |
2 files changed, 46 insertions, 33 deletions
diff --git a/stdlib/source/test/aedifex/repository.lux b/stdlib/source/test/aedifex/repository.lux index 5d2b62f57..af96bc572 100644 --- a/stdlib/source/test/aedifex/repository.lux +++ b/stdlib/source/test/aedifex/repository.lux @@ -21,26 +21,18 @@ [world [net ["." uri (#+ URI)]]]] - [// - ["@." artifact]] + ["." / #_ + ["#." identity] + [// + ["@." artifact]]] {#spec ["$." /]} {#program - ["." / (#+ Identity) + ["." / ["/#" // #_ ["#." artifact (#+ Version Artifact) ["#/." extension (#+ Extension)]]]]}) -(def: #export identity - (Random Identity) - (random.and (random.ascii/alpha 10) - (random.ascii/alpha 10))) - -(def: identity-equivalence - (Equivalence Identity) - (product.equivalence text.equivalence - text.equivalence)) - (def: artifact (-> Version Artifact) (|>> ["com.github.luxlang" "test-artifact"])) @@ -49,10 +41,6 @@ (exception.report ["URI" (%.text uri)])) -(exception: (invalid-identity {[user _] Identity}) - (exception.report - ["User" (%.text user)])) - (type: Store (Dictionary URI Binary)) @@ -60,8 +48,8 @@ Store (dictionary.new text.hash)) -(structure: #export (simulation identity) - (-> Identity (/.Simulation Store)) +(structure: #export simulation + (/.Simulation Store) (def: (on-download uri state) (case (dictionary.get uri state) @@ -70,21 +58,16 @@ #.None (exception.throw ..not-found [uri]))) - (def: (on-upload requester uri content state) - (if (\ identity-equivalence = identity requester) - (exception.return (dictionary.put uri content state)) - (exception.throw ..invalid-identity [requester])))) + (def: (on-upload uri content state) + (exception.return (dictionary.put uri content state)))) (def: #export test Test (<| (_.covering /._) - (do {! random.monad} - [valid ..identity - invalid (random.filter (|>> (\ identity-equivalence = valid) not) - ..identity)] - ($_ _.and - (_.for [/.mock /.Simulation] - ($/.spec valid (..artifact "1.2.3-YES") - invalid (..artifact "4.5.6-NO") - (/.mock (..simulation valid) ..empty))) - )))) + ($_ _.and + (_.for [/.mock /.Simulation] + ($/.spec (..artifact "1.2.3-YES") + (..artifact "4.5.6-NO") + (/.mock ..simulation ..empty))) + /identity.test + ))) diff --git a/stdlib/source/test/aedifex/repository/identity.lux b/stdlib/source/test/aedifex/repository/identity.lux new file mode 100644 index 000000000..98d798cf7 --- /dev/null +++ b/stdlib/source/test/aedifex/repository/identity.lux @@ -0,0 +1,30 @@ +(.module: + [lux #* + ["_" test (#+ Test)] + [abstract + {[0 #spec] + [/ + ["$." equivalence]]}] + [data + ["." product] + ["." text]] + [math + ["." random (#+ Random)]]] + {#program + ["." /]}) + +(def: #export random + (Random /.Identity) + ($_ random.and + (random.ascii/alpha 10) + (random.ascii/alpha 10) + )) + +(def: #export test + Test + (<| (_.covering /._) + (_.for [/.Identity] + ($_ _.and + (_.for [/.equivalence] + ($equivalence.spec /.equivalence ..random)) + )))) |