blob: ca219323adb9a98aa0dd80641ba722d739453650 (
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
|
(.using
[library
[lux "*"
["_" test {"+" Test}]
["[0]" static]
["[0]" meta]
[abstract
[monad {"+" do}]]
[control
["[0]" try]
["[0]" exception]
[parser
["<[0]>" code]]]
[data
["[0]" text]]
["[0]" macro
[syntax {"+" syntax:}]
["[0]" code]]
[math
["[0]" random]
[number
["n" nat]]]]]
[\\library
["[0]" /]])
(syntax: (failure [it <code>.any])
(function (_ lux)
(case (macro.expansion it lux)
{try.#Failure error}
{try.#Success [lux (list (code.text error))]}
{try.#Success _}
{try.#Failure ""})))
(def: .public test
Test
(<| (_.covering /._)
(with_expansions [<current> (/.current)
<fake> (static.random code.text (random.ascii/lower 1))])
($_ _.and
(_.cover [/.latest]
(n.> 0 /.latest))
(_.cover [/.current]
(not (text.empty? (/.current))))
(_.cover [/.for]
(and (/.for [<current> true]
false)
(/.for [<fake> false]
true)))
(_.cover [/.invalid]
(and (text.contains? (the exception.#label /.invalid)
(..failure (/.for [])))
(text.contains? (the exception.#label /.invalid)
(..failure (/.for [<fake> false])))))
)))
|