blob: 8272618f623ed83ede76e7d24f6ca8f856b68859 (
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
60
61
62
63
64
65
66
|
... 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]" io]
["[0]" try]
["[0]" exception]]
[data
["[0]" text (.use "[1]#[0]" equivalence)]]
[math
["[0]" random (.only Random)]]
[meta
[compiler
[target
[jvm
["[0]" bytecode]]]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" /]])
(def .public test
Test
(<| (_.covering /._)
(do [! random.monad]
[expected (random.upper_cased 1)])
(all _.and
(_.coverage [/.host]
(io.run! (do io.monad
[[class_loader host] /.host]
(in (when (of host evaluate [{.#None} (bytecode.string expected)])
{try.#Success actual}
(text#= expected (as Text actual))
{try.#Failure error}
false)))))
(_.coverage [/.invalid_value]
(io.run! (do io.monad
[[class_loader host] /.host]
(in (when (of host evaluate [{.#None} bytecode.aconst_null])
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.invalid_value error))))))
(_.coverage [/.cannot_load]
(io.run! (do io.monad
[[class_loader host] /.host]
(in (when (of host evaluate [{.#None} (all bytecode.composite
bytecode.lconst_0
bytecode.lconst_0
bytecode.ldiv
bytecode.pop2
(bytecode.string expected)
)])
{try.#Success _}
false
{try.#Failure error}
(exception.match? /.cannot_load error))))))
)))
|