blob: 9ffcd4ada812e154aeea54e8316f03e24c5ac53a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
(.using
[library
[lux "*"
["_" test {"+" Test}]
[abstract
[monad {"+" do}]]
[control
["[0]" try]
[concurrency
["[0]" async]]]
[math
["[0]" random]]
[world
["[0]" file]]]]
[\\library
["[0]" /]]
["$[0]" // "_"
["[1][0]" context]])
(def: .public test
Test
(<| (_.covering /._)
(do [! random.monad]
[.let [/ "/"
fs (file.mock /)]
context $//context.random]
($_ _.and
(in (do async.monad
[pre/0 (# fs directory? (/.path fs context))
pre/1 (/.enabled? fs context)
outcome (/.enable! fs context)
post/0 (# fs directory? (/.path fs context))
post/1 (/.enabled? fs context)]
(_.cover' [/.path /.enabled? /.enable!]
(and (not pre/0)
(not pre/1)
(case outcome
{try.#Success _} true
{try.#Failure _} false)
post/0
post/1))))
))))
|