aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/aedifex/repository
diff options
context:
space:
mode:
authorEduardo Julian2021-07-11 01:51:04 -0400
committerEduardo Julian2021-07-11 01:51:04 -0400
commitabe24425ced15fd784ef6c62d6f186af72b491db (patch)
tree42b6e3cbd179c83fae8941fa4b128b13afc766f5 /stdlib/source/test/aedifex/repository
parent4610968193df10af12c91f699fec39aeb3ef703a (diff)
Re-named ":coerce" to ":as" since it technically doesn't do coercions.
Diffstat (limited to 'stdlib/source/test/aedifex/repository')
-rw-r--r--stdlib/source/test/aedifex/repository/local.lux51
1 files changed, 51 insertions, 0 deletions
diff --git a/stdlib/source/test/aedifex/repository/local.lux b/stdlib/source/test/aedifex/repository/local.lux
new file mode 100644
index 000000000..946494437
--- /dev/null
+++ b/stdlib/source/test/aedifex/repository/local.lux
@@ -0,0 +1,51 @@
+(.module:
+ [lux #*
+ ["_" test (#+ Test)]
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try ("#\." functor)]
+ [parser
+ ["." environment]]
+ [concurrency
+ ["." promise]]]
+ [data
+ ["." binary ("#\." equivalence)]
+ [text
+ [encoding
+ ["." utf8]]]]
+ [math
+ ["." random]]
+ [world
+ ["." file]
+ ["." program]]]
+ {#program
+ ["." /]})
+
+(def: #export test
+ Test
+ (<| (_.covering /._)
+ (do {! random.monad}
+ [/ (random.ascii/upper 1)
+ home (random.ascii/lower 10)
+ working_directory (random.ascii/lower 10)
+ #let [fs (file.mock /)
+ program (program.async (program.mock environment.empty home working_directory))
+ repo (/.repository program fs)]
+
+ uri (random.ascii/lower 10)
+ expected (\ ! map (\ utf8.codec encode)
+ (random.ascii/lower 10))]
+ ($_ _.and
+ (wrap (do promise.monad
+ [before_upload (\ repo download uri)
+ _ (\ repo upload uri expected)
+ actual (\ repo download uri)]
+ (_.cover' [/.repository]
+ (and (case before_upload
+ (#try.Success _) false
+ (#try.Failure _) true)
+ (|> actual
+ (try\map (binary\= expected))
+ (try.default false))))))
+ ))))