blob: b92ebe145304f3d5384fcad98c5d39ec0a72f653 (
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
|
(.module:
[lux #*
["_" test (#+ Test)]
[abstract
[monad (#+ do)]
{[0 #spec]
[/
["$." equivalence]]}]
[control
[pipe (#+ case>)]
["." try]
[parser
["." cli]]]
[data
["." text ("#\." equivalence)]]
[math
["." random (#+ Random) ("#\." monad)]]]
{#program
["." /
["/#" // #_
["#" profile]]]})
(def: compilation
(Random /.Compilation)
(random.or (random\wrap [])
(random\wrap [])))
(def: command
(Random /.Command)
($_ random.or
## #Version
(random\wrap [])
## #Clean
(random\wrap [])
## #POM
(random\wrap [])
## #Dependencies
(random\wrap [])
## #Install
(random\wrap [])
## #Deploy
($_ random.and
(random.ascii/alpha 1)
(random.ascii/alpha 1)
(random.ascii/alpha 1))
## #Compilation
..compilation
## #Auto
..compilation))
(def: (format-compilation value)
(-> /.Compilation (List Text))
(case value
#/.Build (list "build")
#/.Test (list "test")))
(def: (format value)
(-> /.Command (List Text))
(case value
#/.Version (list "version")
#/.Clean (list "clean")
#/.POM (list "pom")
#/.Dependencies (list "deps")
#/.Install (list "install")
(#/.Deploy repository [user password]) (list "deploy" repository user password)
(#/.Compilation compilation) (..format-compilation compilation)
(#/.Auto compilation) (list& "auto" (..format-compilation compilation))))
(def: without-profile
Test
(do random.monad
[expected ..command]
(_.test "Without profile."
(|> expected
..format
(cli.run /.command)
(case> (#try.Success [name actual])
(and (text\= //.default name)
(\ /.equivalence = expected actual))
(#try.Failure error)
false)))))
(def: with-profile
Test
(do random.monad
[expected-profile (random.ascii/alpha 1)
expected-command ..command]
(_.test "With profile."
(|> expected-command
..format
(list& "with" expected-profile)
(cli.run /.command)
(case> (#try.Success [actual-profile actual-command])
(and (text\= expected-profile actual-profile)
(\ /.equivalence = expected-command actual-command))
(#try.Failure error)
false)))))
(def: #export test
Test
(<| (_.covering /._)
(_.for [/.Compilation /.Command]
($_ _.and
(_.for [/.equivalence]
($equivalence.spec /.equivalence ..command))
(_.for [/.command]
($_ _.and
..without-profile
..with-profile
))))))
|