blob: 64060127be5d6d620f23c4b4e9f98ba882cc8f27 (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
(.require
[library
[lux (.except)
[abstract
[monad (.only do)]]
[control
["[0]" try]
[function
["[0]" predicate]]
[concurrency
["[0]" async]]]
[data
["[0]" text (.use "[1]#[0]" equivalence)
["%" \\format (.only format)]
[encoding
["[0]" utf8]]]
[collection
["[0]" dictionary]
["[0]" set]]
[format
["[0]" xml]]]
[math
["[0]" random (.only Random)]]
[world
["[0]" file]
["[0]" environment
["program" /]
["[1]" \\parser]]]
[test
["[0]" unit]
["_" property (.only Test)]]]]
["[0]" //
["@[0]" version]
["$/[1]" //
["[1][0]" package]
["[1][0]" artifact]
["[1][0]" dependency
["[1]/[0]" resolution]]]]
[\\program
["[0]" / (.only)
["/[1]" //
["[1][0]" clean]
["/[1]" //
["[1]" profile]
["[1][0]" action]
["[1][0]" pom]
["[1][0]" package]
["[1][0]" artifact (.only)
["[1]/[0]" type]]
["[1][0]" dependency (.only)
["[1]/[0]" resolution]
["[1]/[0]" deployment]
["[1]/[0]" status]]
["[1][0]" repository (.only)
["[1]/[0]" origin]
["[1]/[0]" local]]]]]])
(def .public test
Test
(<| (_.covering /._)
(do random.monad
[home (random.alphabetic 5)
working_directory (random.alphabetic 5)
dependee_artifact $///artifact.random
depender_artifact (random.only (predicate.complement
(at ///artifact.equivalence = dependee_artifact))
$///artifact.random)
[_ dependee_package] $///package.random
[_ depender_package] $///package.random
.let [dependee [///dependency.#artifact dependee_artifact
///dependency.#type ///artifact/type.lux_library]
depender [///dependency.#artifact depender_artifact
///dependency.#type ///artifact/type.lux_library]
dependee_pom (|> (at ///.monoid identity)
(has ///.#identity {.#Some dependee_artifact})
///pom.write
try.trusted)
depender_pom (|> (at ///.monoid identity)
(has ///.#identity {.#Some depender_artifact})
(has ///.#dependencies (set.of_list ///dependency.hash (list dependee)))
///pom.write
try.trusted)
dependee_package (|> dependee_package
(has ///package.#origin {///repository/origin.#Remote ""})
(has ///package.#pom [dependee_pom
(|> dependee_pom (at xml.codec encoded) (at utf8.codec encoded))
{///dependency/status.#Unverified}]))
depender_package (|> depender_package
(has ///package.#origin {///repository/origin.#Remote ""})
(has ///package.#pom [depender_pom
(|> depender_pom (at xml.codec encoded) (at utf8.codec encoded))
{///dependency/status.#Unverified}]))
fs (file.mock (at file.default separator))
program (program.async (program.mock environment.empty home working_directory))]]
(in (do async.monad
[verdict (do ///action.monad
[.let [console (@version.echo "")
local (///repository/local.repository program fs)]
pre (|> ///dependency/resolution.empty
(dictionary.has dependee dependee_package)
(///dependency/deployment.all local))
post (|> (at ///.monoid identity)
(has ///.#dependencies (set.of_list ///dependency.hash (list dependee depender)))
(/.do! console local
(list (///repository.mock ($///dependency/resolution.single depender_artifact depender_package)
[]))
(function (_ url)
(///repository.mock $///dependency/resolution.nope []))))
.let [had_dependee_before!
(set.member? pre dependee_artifact)
lacked_depender_before!
(not (set.member? pre depender_artifact))
had_dependee_after!
(dictionary.key? post dependee)
had_depender_after!
(dictionary.key? post depender)]]
(in (and had_dependee_before!
lacked_depender_before!
had_dependee_after!
had_depender_after!)))]
(unit.coverage [/.do!]
(try.else false verdict)))))))
|