From d29e091e98dabb8dfcf816899ada480ecbf7e357 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 23 Dec 2020 06:33:44 -0400 Subject: Refactored "export" common syntax. --- stdlib/source/test/aedifex/repository.lux | 49 ++++++++++--------------------- 1 file changed, 16 insertions(+), 33 deletions(-) (limited to 'stdlib/source/test/aedifex/repository.lux') 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 + ))) -- cgit v1.2.3