aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/meta/compiler/meta/cache.lux
blob: c01794cc1a983645e7759d51b705109d5fa35722 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]]
   [control
    ["[0]" try]
    [concurrency
     ["[0]" async]]]
   [math
    ["[0]" random]]
   [world
    ["[0]" file]]
   [test
    ["[0]" unit]
    ["_" property (.only Test)]]]]
 [\\library
  ["[0]" /]]
 ["[0]" /
  ["[1][0]" archive]
  ["[1][0]" module]
  ["[1][0]" artifact]
  ["[1][0]" purge]
  ["[1][0]" dependency
   ["[1]/[0]" module]]])

(def .public test
  Test
  (<| (_.covering /._)
      (do [! random.monad]
        [.let [/ "/"
               fs (file.mock /)]]
        (all _.and
             (in (do [! async.monad]
                   [pre/0 (of fs directory? /.path)
                    pre/1 (/.enabled? fs)
                    outcome (/.enable! ! fs)
                    post/0 (of fs directory? /.path)
                    post/1 (/.enabled? fs)]
                   (unit.coverage [/.path /.enabled? /.enable!]
                     (and (not pre/0)
                          (not pre/1)
                          
                          (when outcome
                            {try.#Success _} true
                            {try.#Failure _} false)
                          
                          post/0
                          post/1))))

             /archive.test
             /module.test
             /artifact.test
             /purge.test
             /dependency/module.test
             ))))