aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/specification/lux/world/program.lux
blob: b6f859b9c5817f32b93a9416a467e48e290dfe36 (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
(.using
 [library
  [lux (.full)
   ["_" test (.only Test)]
   [abstract
    [monad (.only do)]]
   [control
    ["[0]" try]
    [concurrency
     ["[0]" async (.only Async)]]]
   [data
    ["[0]" text]
    [collection
     ["[0]" dictionary]
     ["[0]" list]]]
   [math
    ["[0]" random]]]]
 [\\library
  ["[0]" /]])

(def: .public (spec subject)
  (-> (/.Program Async) Test)
  (do random.monad
    [exit random.int]
    (in (do [! async.monad]
          [environment (/.environment ! subject)]
          (_.coverage' [/.Program]
            (and (not (dictionary.empty? environment))
                 (list.every? (|>> text.empty? not)
                              (dictionary.keys environment))
                 (not (text.empty? (# subject home)))
                 (not (text.empty? (# subject directory)))))))))