aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/repository.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-12-23 06:33:44 -0400
committerEduardo Julian2020-12-23 06:33:44 -0400
commitd29e091e98dabb8dfcf816899ada480ecbf7e357 (patch)
treea9d34c7fbb700cdb0c1f1226d377150614ce9914 /stdlib/source/test/aedifex/repository.lux
parentcad959345afb8bf0bd1e5eefe6c63f136833b3ce (diff)
Refactored "export" common syntax.
Diffstat (limited to 'stdlib/source/test/aedifex/repository.lux')
-rw-r--r--stdlib/source/test/aedifex/repository.lux49
1 files changed, 16 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
+ )))