conjur-asset-ui 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +7 -0
  2. data/.git-hooks/pre_commit/ensure_livescript_compiled.rb +31 -0
  3. data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
  4. data/.gitignore +20 -0
  5. data/.overcommit.yml +5 -0
  6. data/.project +18 -0
  7. data/CHANGELOG.md +3 -0
  8. data/Gemfile +8 -0
  9. data/LICENSE.txt +22 -0
  10. data/README.md +41 -0
  11. data/Rakefile +3 -0
  12. data/compile_ls +6 -0
  13. data/conjur-asset-ui.gemspec +37 -0
  14. data/lib/conjur/command/ui.rb +46 -0
  15. data/lib/conjur/webserver/api_proxy.rb +94 -0
  16. data/lib/conjur/webserver/authorize.rb +28 -0
  17. data/lib/conjur/webserver/conjur_info.rb +33 -0
  18. data/lib/conjur/webserver/home.rb +42 -0
  19. data/lib/conjur/webserver/login.rb +57 -0
  20. data/lib/conjur/webserver/renderer.rb +34 -0
  21. data/lib/conjur/webserver/server.rb +113 -0
  22. data/lib/conjur-asset-ui-version.rb +7 -0
  23. data/lib/conjur-asset-ui.rb +7 -0
  24. data/livescript/views/audit.ls +136 -0
  25. data/public/_client_code.html +42 -0
  26. data/public/_client_libs.html +24 -0
  27. data/public/css/bootstrap.css +7 -0
  28. data/public/css/styles.less +461 -0
  29. data/public/fonts/glyphicons-halflings-regular.eot +0 -0
  30. data/public/fonts/glyphicons-halflings-regular.svg +229 -0
  31. data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
  32. data/public/fonts/glyphicons-halflings-regular.woff +0 -0
  33. data/public/images/conjur-logo.svg +26 -0
  34. data/public/images/icon-client-pc.svg +12 -0
  35. data/public/images/icon-environment.png +0 -0
  36. data/public/images/icon-person.svg +12 -0
  37. data/public/images/icon-policy.png +0 -0
  38. data/public/images/icon-resource.png +0 -0
  39. data/public/images/icon-service-dots.svg +13 -0
  40. data/public/images/icon-variable.png +0 -0
  41. data/public/index.html.erb +62 -0
  42. data/public/js/init.js +107 -0
  43. data/public/js/lib/JSXTransformer.js +10862 -0
  44. data/public/js/lib/async.js +958 -0
  45. data/public/js/lib/backbone.js +2 -0
  46. data/public/js/lib/bootstrap.js +6 -0
  47. data/public/js/lib/date.extensions.js +141 -0
  48. data/public/js/lib/less.js +16 -0
  49. data/public/js/lib/moment.js +7768 -0
  50. data/public/js/lib/pace.js +2 -0
  51. data/public/js/lib/prelude-browser-min.js +1 -0
  52. data/public/js/lib/react-bootstrap.js +5346 -0
  53. data/public/js/lib/react-bootstrap.min.js +4 -0
  54. data/public/js/lib/sorted-set.no-require.js +1170 -0
  55. data/public/js/lib/sorted-set.no-require.js.txt +6 -0
  56. data/public/js/lib/underscore-min.js +6 -0
  57. data/public/js/lib/underscore.string.min.js +1 -0
  58. data/public/js/main.js +57 -0
  59. data/public/js/models/groupRecord.js +70 -0
  60. data/public/js/models/hostRecord.js +55 -0
  61. data/public/js/models/layerRecord.js +77 -0
  62. data/public/js/models/namespace.js +10 -0
  63. data/public/js/models/policyList.js +14 -0
  64. data/public/js/models/policyRecord.js +54 -0
  65. data/public/js/models/record.js +85 -0
  66. data/public/js/models/resourceList.js +69 -0
  67. data/public/js/models/userList.js +20 -0
  68. data/public/js/models/userRecord.js +70 -0
  69. data/public/js/models/variableList.js +16 -0
  70. data/public/js/models/variableRecord.js +73 -0
  71. data/public/js/routers.js +205 -0
  72. data/public/js/views/annotations.js +36 -0
  73. data/public/js/views/audit.js +363 -0
  74. data/public/js/views/dashboard.js +67 -0
  75. data/public/js/views/generic.js +115 -0
  76. data/public/js/views/group.js +61 -0
  77. data/public/js/views/groups.js +30 -0
  78. data/public/js/views/host.js +64 -0
  79. data/public/js/views/hosts.js +30 -0
  80. data/public/js/views/layer.js +92 -0
  81. data/public/js/views/layers.js +30 -0
  82. data/public/js/views/mixins/search.js +15 -0
  83. data/public/js/views/mixins/tabs.js +114 -0
  84. data/public/js/views/namespaces.js +40 -0
  85. data/public/js/views/navSearch.js +25 -0
  86. data/public/js/views/owned.js +178 -0
  87. data/public/js/views/permissions.js +188 -0
  88. data/public/js/views/policies.js +28 -0
  89. data/public/js/views/policy.js +43 -0
  90. data/public/js/views/resource.js +39 -0
  91. data/public/js/views/role.js +41 -0
  92. data/public/js/views/searchResults.js +145 -0
  93. data/public/js/views/time.js +14 -0
  94. data/public/js/views/user.js +68 -0
  95. data/public/js/views/users.js +31 -0
  96. data/public/js/views/variable.js +70 -0
  97. data/public/js/views/variables.js +30 -0
  98. data/spec/javascripts/helpers/.gitkeep +0 -0
  99. data/spec/javascripts/support/jasmine.yml +112 -0
  100. data/spec/javascripts/support/jasmine_helper.rb +22 -0
  101. data/spec/javascripts/support/run.html.erb +23 -0
  102. data/spec/javascripts/views/AuditSpec.js +22 -0
  103. data/spec/javascripts/views/AuditSpec.ls +18 -0
  104. data/vendor/prelude-ls/.gitignore +2 -0
  105. data/vendor/prelude-ls/.travis.yml +3 -0
  106. data/vendor/prelude-ls/CHANGELOG.md +81 -0
  107. data/vendor/prelude-ls/LICENSE +22 -0
  108. data/vendor/prelude-ls/Makefile +50 -0
  109. data/vendor/prelude-ls/README.md +15 -0
  110. data/vendor/prelude-ls/browser/prelude-browser-min.js +1 -0
  111. data/vendor/prelude-ls/browser/prelude-browser.js +1172 -0
  112. data/vendor/prelude-ls/lib/Func.js +40 -0
  113. data/vendor/prelude-ls/lib/List.js +602 -0
  114. data/vendor/prelude-ls/lib/Num.js +129 -0
  115. data/vendor/prelude-ls/lib/Obj.js +153 -0
  116. data/vendor/prelude-ls/lib/Str.js +68 -0
  117. data/vendor/prelude-ls/lib/index.js +164 -0
  118. data/vendor/prelude-ls/package.json +50 -0
  119. data/vendor/prelude-ls/package.ls +46 -0
  120. data/vendor/prelude-ls/src/Func.ls +17 -0
  121. data/vendor/prelude-ls/src/List.ls +299 -0
  122. data/vendor/prelude-ls/src/Num.ls +83 -0
  123. data/vendor/prelude-ls/src/Obj.ls +61 -0
  124. data/vendor/prelude-ls/src/Str.ls +32 -0
  125. data/vendor/prelude-ls/src/index.ls +56 -0
  126. data/vendor/prelude-ls/test/Func.ls +36 -0
  127. data/vendor/prelude-ls/test/List.ls +751 -0
  128. data/vendor/prelude-ls/test/Num.ls +258 -0
  129. data/vendor/prelude-ls/test/Obj.ls +145 -0
  130. data/vendor/prelude-ls/test/Prelude.ls +49 -0
  131. data/vendor/prelude-ls/test/Str.ls +208 -0
  132. data/vendor/prelude-ls/test/browser.html +5 -0
  133. metadata +369 -0
@@ -0,0 +1,258 @@
1
+ {
2
+ max, min, negate, abs, signum, quot, rem, div, mod, recip,
3
+ pi, tau, exp, sqrt, ln, pow, sin, tan, cos, acos, asin, atan, atan2,
4
+ truncate, round, ceiling, floor, is-it-NaN, even, odd, gcd, lcm,
5
+ } = require '..'
6
+ {equal: eq, deep-equal: deep-eq, ok} = require 'assert'
7
+
8
+ suite 'max' ->
9
+ test 'numbers' ->
10
+ eq 3, max 3 3
11
+ eq 3, max 2 3
12
+ eq 3, max 3 2
13
+
14
+ test 'characters' ->
15
+ eq \b, max \a \b
16
+
17
+ test 'curried' ->
18
+ f = max 2
19
+ eq 3, f 3
20
+
21
+ suite 'min' ->
22
+ test 'numbers' ->
23
+ eq 0, min 9 0
24
+
25
+ test 'characters' ->
26
+ eq \a, min \a \b
27
+
28
+ test 'curried' ->
29
+ f = min 9
30
+ eq 0, f 0
31
+
32
+ suite 'negate' ->
33
+ test 'zero' ->
34
+ eq 0, negate 0
35
+
36
+ test 'negative number' ->
37
+ eq -2, negate 2
38
+
39
+ test 'positive number' ->
40
+ eq 3, negate -3
41
+
42
+ suite 'abs' ->
43
+ test 'zero' ->
44
+ eq 0, abs 0
45
+
46
+ test 'negative number' ->
47
+ eq 4 abs -4
48
+
49
+ test 'positive number' ->
50
+ eq 4 abs 4
51
+
52
+ suite 'signum' ->
53
+ test 'zero' ->
54
+ eq 0 signum 0
55
+
56
+ test 'negative number' ->
57
+ eq -1 signum -5.3
58
+
59
+ test 'positive number' ->
60
+ eq 1 signum 8
61
+
62
+ suite 'quot' ->
63
+ test 'simple' ->
64
+ eq -6, quot -20 3
65
+
66
+ test 'curried' ->
67
+ f = quot -20
68
+ eq -6, f 3
69
+
70
+ suite 'rem' ->
71
+ test 'simple' ->
72
+ eq -2, rem -20 3
73
+
74
+ test 'curried' ->
75
+ f = rem -20
76
+ eq -2, f 3
77
+
78
+ suite 'div' ->
79
+ test 'simple' ->
80
+ eq -7, div -20 3
81
+
82
+ test 'curried' ->
83
+ f = div -20
84
+ eq -7, f 3
85
+
86
+ suite 'mod' ->
87
+ test 'simple' ->
88
+ eq 1, mod -20 3
89
+
90
+ test 'curried' ->
91
+ f = mod -20
92
+ eq 1, f 3
93
+
94
+ suite 'recip' ->
95
+ test 'zero' ->
96
+ eq Infinity, recip 0
97
+
98
+ test 'larger than 1' ->
99
+ eq 0.5, recip 2
100
+
101
+ test 'between 0 and 1' ->
102
+ eq 2, recip 0.5
103
+
104
+ suite 'pi' ->
105
+ test 'constant' ->
106
+ eq 3.141592653589793, pi
107
+
108
+ suite 'tau' ->
109
+ test 'constant' ->
110
+ eq 6.283185307179586, tau
111
+
112
+ suite 'exp' ->
113
+ test 'simple' ->
114
+ eq 2.718281828459045, exp 1
115
+
116
+ suite 'sqrt' ->
117
+ test 'negative numbers' ->
118
+ ok is-it-NaN sqrt -1
119
+
120
+ test 'simple' ->
121
+ eq 2 sqrt 4
122
+
123
+ suite 'ln' ->
124
+ test 'simple' ->
125
+ eq 0.6931471805599453, ln 2
126
+
127
+ suite 'pow' ->
128
+ test 'simple' ->
129
+ eq 4, pow 2 2
130
+ eq 4, pow -2 2
131
+
132
+ test 'with negative numbers' ->
133
+ eq 0.25, pow 2 -2
134
+
135
+ test 'between one and zero' ->
136
+ eq 4, pow 16 0.5
137
+
138
+ test 'curried' ->
139
+ f = pow 2
140
+ eq 4, f 2
141
+
142
+ suite 'sin' ->
143
+ test 'zero' ->
144
+ eq 0, sin 0
145
+
146
+ test 'one' ->
147
+ eq 0.8414709848078965, sin 1
148
+
149
+ suite 'tan' ->
150
+ test 'zero' ->
151
+ eq 0, tan 0
152
+
153
+ test 'one' ->
154
+ eq 1.5574077246549023, tan 1
155
+
156
+ suite 'cos' ->
157
+ test 'zero' ->
158
+ eq 1, cos 0
159
+
160
+ test 'one' ->
161
+ eq 0.5403023058681398, cos 1
162
+
163
+ suite 'acos' ->
164
+ test 'number' ->
165
+ eq 1.4706289056333368, acos 0.1
166
+
167
+ suite 'asin' ->
168
+ test 'number' ->
169
+ eq 1.5707963267948966, asin 1
170
+
171
+ suite 'atan' ->
172
+ test 'number' ->
173
+ eq 0.7853981633974483, atan 1
174
+
175
+ suite 'atan2' ->
176
+ test 'number' ->
177
+ eq 0.4636476090008061, atan2 1 2
178
+
179
+ test 'curried' ->
180
+ f = atan2 1
181
+ eq 0.4636476090008061, f 2
182
+
183
+ suite 'truncate' ->
184
+ test 'zero' ->
185
+ eq 0, truncate 0
186
+
187
+ test 'positive number' ->
188
+ eq 1 truncate 1.5
189
+
190
+ test 'negative number' ->
191
+ eq -1 truncate -1.5
192
+
193
+ suite 'round' ->
194
+ test 'up' ->
195
+ eq 1 round 0.6
196
+ eq 1 round 0.5
197
+
198
+ test 'down' ->
199
+ eq 0 round 0.4
200
+
201
+ suite 'ceiling' ->
202
+ test 'zero' ->
203
+ eq 0, ceiling 0
204
+
205
+ test 'positive number' ->
206
+ eq 1, ceiling 0.1
207
+
208
+ test 'negative number' ->
209
+ eq 0, ceiling -0.9
210
+
211
+ suite 'floor' ->
212
+ test 'zero' ->
213
+ eq 0, floor 0
214
+
215
+ test 'positive number' ->
216
+ eq 0, floor 0.9
217
+
218
+ test 'negative number' ->
219
+ eq -1, floor -0.1
220
+
221
+ suite 'is-it-NaN' ->
222
+ test 'true' ->
223
+ ok is-it-NaN Math.sqrt -1
224
+
225
+ test 'false' ->
226
+ ok not is-it-NaN '0'
227
+
228
+ suite 'even' ->
229
+ test 'true' ->
230
+ ok even 0
231
+ ok even -2
232
+
233
+ test 'false' ->
234
+ ok not even 7
235
+
236
+ suite 'odd' ->
237
+ test 'true' ->
238
+ ok odd 3
239
+
240
+ test 'false' ->
241
+ ok not odd -4
242
+ ok not odd 0
243
+
244
+ suite 'gcd' ->
245
+ test 'some numbers' ->
246
+ eq 6, gcd 12 18
247
+
248
+ test 'curried' ->
249
+ f = gcd 12
250
+ eq 6, f 18
251
+
252
+ suite 'lcm' ->
253
+ test 'some numbers' ->
254
+ eq 36, lcm 12 18
255
+
256
+ test 'curried' ->
257
+ f = lcm 12
258
+ eq 36, f 18
@@ -0,0 +1,145 @@
1
+ {
2
+ id
3
+ Obj: {
4
+ values, keys,
5
+ pairs-to-obj, obj-to-pairs, lists-to-obj, obj-to-lists,
6
+ empty, each, map, filter, compact, reject, partition, find,
7
+ }
8
+ } = require '..'
9
+ {equal: eq, deep-equal: deep-eq, ok} = require 'assert'
10
+
11
+ suite 'values' ->
12
+ test 'empty object as input' ->
13
+ deep-eq [], values {}
14
+
15
+ test 'object as input' ->
16
+ deep-eq [1 2 3], values sadf: 1, asdf: 2, fdas: 3
17
+
18
+ suite 'keys' ->
19
+ test 'empty object as input' ->
20
+ deep-eq [], keys {}
21
+
22
+ test 'object as input' ->
23
+ deep-eq <[ sadf asdf fdas ]>, keys sadf: 1, asdf: 2, fdas: 3
24
+
25
+ suite 'pairs-to-obj' ->
26
+ test 'empty list as input' ->
27
+ deep-eq {}, pairs-to-obj []
28
+
29
+ test 'pairs as input' ->
30
+ deep-eq {a: 'b', c: 'd', e: 1}, pairs-to-obj [['a' 'b'] ['c' 'd'] ['e' 1]]
31
+
32
+ suite 'obj-to-pairs' ->
33
+ test 'empty object as input' ->
34
+ deep-eq [], obj-to-pairs {}
35
+
36
+ test 'object as input' ->
37
+ deep-eq [['a' 'b'] ['c' 'd'] ['e' 1]], obj-to-pairs {a: 'b', c: 'd', e: 1}
38
+
39
+ suite 'lists-to-obj' ->
40
+ test 'empty lists as input' ->
41
+ deep-eq {}, lists-to-obj [] []
42
+
43
+ test 'two lists of the same length' ->
44
+ deep-eq {a: 1, b: 2, c: 3}, lists-to-obj <[ a b c ]> [1 2 3]
45
+
46
+ test 'first list is shorter' ->
47
+ deep-eq {a: 1, b: 2}, lists-to-obj <[ a b ]> [1 2 3]
48
+
49
+ test 'first list is longer' ->
50
+ deep-eq {a: 1, b: 2, c: void}, lists-to-obj <[ a b c ]> [1 2]
51
+
52
+ test 'curried' ->
53
+ f = lists-to-obj <[ a b c ]>
54
+ deep-eq {a: 1, b: 2, c: 3}, f [1 2 3]
55
+
56
+ suite 'obj-to-lists' ->
57
+ test 'empty object as input' ->
58
+ deep-eq [[], []], obj-to-lists {}
59
+
60
+ test 'two lists of the same length' ->
61
+ deep-eq [<[ a b c ]>, [1 2 3]], obj-to-lists {a: 1, b: 2, c: 3}
62
+
63
+ suite 'empty' ->
64
+ test 'empty object as input' ->
65
+ ok empty {}
66
+
67
+ test 'non-empty object as input' ->
68
+ ok not empty {x: 1}
69
+
70
+ suite 'each' ->
71
+ test 'empty object as input' ->
72
+ deep-eq {}, each id, {}
73
+
74
+ test 'iterate over object values' ->
75
+ count = 4
76
+ each (-> count += it), {a: 1, b: 2, c: 3}
77
+ eq 10 count
78
+
79
+ test 'curried' ->
80
+ count = 4
81
+ f = each (-> count += it)
82
+ f {a: 1, b: 2, c: 3}
83
+ eq 10 count
84
+
85
+ suite 'map' ->
86
+ test 'empty object as input' ->
87
+ deep-eq {}, map id, {}
88
+
89
+ test 'mapping over object' ->
90
+ deep-eq {a:2, b:4}, map (* 2), {a:1, b:2}
91
+
92
+ test 'curried' ->
93
+ f = map (* 2)
94
+ deep-eq {a:2, b:4}, f {a:1, b:2}
95
+
96
+ suite 'compact' ->
97
+ test 'empty object as input' ->
98
+ deep-eq {}, compact {}
99
+
100
+ test 'compacting object' ->
101
+ deep-eq {b: 1, e: 'ha'}, compact {a: 0, b: 1, c: false, d: '', e: 'ha'}
102
+
103
+ suite 'filter' ->
104
+ test 'empty object as input' ->
105
+ deep-eq {}, filter id, {}
106
+
107
+ test 'filtering object' ->
108
+ deep-eq {b: 2}, filter (== 2), {a:1, b:2}
109
+
110
+ test 'curried' ->
111
+ f = filter (== 2)
112
+ deep-eq {b: 2}, f {a:1, b:2}
113
+
114
+ suite 'reject' ->
115
+ test 'empty object as input' ->
116
+ deep-eq {}, reject id, {}
117
+
118
+ test 'reject object' ->
119
+ deep-eq {a: 1}, reject (==2), {a:1, b:2}
120
+
121
+ test 'curried' ->
122
+ f = reject (== 2)
123
+ deep-eq {a: 1}, f {a:1, b:2}
124
+
125
+ suite 'partition' ->
126
+ test 'empty object as input' ->
127
+ deep-eq [{}, {}], partition id, {}
128
+
129
+ test 'partition object' ->
130
+ deep-eq [{b: 2}, {a: 1, c: 3}], partition (==2), {a:1, b:2, c:3}
131
+
132
+ test 'curried' ->
133
+ f = partition (== 2)
134
+ deep-eq [{b: 2}, {a: 1, c: 3}], f {a:1, b:2, c:3}
135
+
136
+ suite 'find' ->
137
+ test 'empty object as input' ->
138
+ eq void, find id, {}
139
+
140
+ test 'find from object' ->
141
+ eq 2, find (==2), {a:1, b:2}
142
+
143
+ test 'curried' ->
144
+ f = find (== 2)
145
+ eq 2, f {a:1, b:2}
@@ -0,0 +1,49 @@
1
+ {id, is-type, replicate} = require '..'
2
+ {equal: eq, deep-equal: deep-eq, ok} = require 'assert'
3
+
4
+ suite 'id' ->
5
+ test 'number' ->
6
+ eq 5, id 5
7
+
8
+ test 'object is the same' ->
9
+ obj = {}
10
+ eq obj, id obj
11
+
12
+ suite 'is-type' ->
13
+ test 'literals' ->
14
+ ok is-type 'Undefined' void
15
+ ok is-type 'Boolean' true
16
+ ok is-type 'Number' 1
17
+ ok is-type 'Number' 1.2
18
+ ok is-type 'String' 'asdfa'
19
+ ok is-type 'Object' {}
20
+ ok is-type 'Array' []
21
+
22
+ ok not is-type 'Boolean' 1
23
+
24
+ test 'constructors' ->
25
+ ok is-type 'Date' new Date
26
+
27
+ test 'classes' ->
28
+ class A
29
+
30
+ ok is-type 'Object' new A
31
+
32
+ test 'curried' ->
33
+ f = is-type 'Boolean'
34
+ ok f true
35
+
36
+ suite 'replicate' ->
37
+ test 'zero as input' ->
38
+ deep-eq [], replicate 0 0
39
+ deep-eq [], replicate 0 'a'
40
+
41
+ test 'number as input' ->
42
+ deep-eq [3,3,3,3], replicate 4 3
43
+
44
+ test 'string as input' ->
45
+ deep-eq <[ a a a a ]>, replicate 4 'a'
46
+
47
+ test 'curried' ->
48
+ f = replicate 4
49
+ deep-eq [3,3,3,3], f 3
@@ -0,0 +1,208 @@
1
+ {
2
+ id
3
+ Str: {
4
+ split, join, lines, unlines, words, unwords, chars, unchars, empty, reverse, repeat,
5
+ slice, take, drop, split-at, take-while, drop-while, span, break-str
6
+ }
7
+ } = require '..'
8
+ {equal: eq, deep-equal: deep-eq, ok} = require 'assert'
9
+
10
+ suite 'split' ->
11
+ test 'empty string as input' ->
12
+ deep-eq [], split '' ''
13
+
14
+ test 'string of some length' ->
15
+ deep-eq <[ 1 2 3 ]>, split '|' '1|2|3'
16
+
17
+ test 'curried' ->
18
+ f = split '|'
19
+ deep-eq <[ 1 2 3 ]>, f '1|2|3'
20
+
21
+ suite 'join' ->
22
+ test 'empty list as input' ->
23
+ eq '' join '', []
24
+
25
+ test 'list as input' ->
26
+ eq '1,2,3', join ',' [1 2 3]
27
+
28
+ test 'empty string as seperator' ->
29
+ eq '123', join '' [1 2 3]
30
+
31
+ test 'curried' ->
32
+ f = join ','
33
+ eq '1,2,3', f [1 2 3]
34
+
35
+ suite 'lines' ->
36
+ test 'empty string as input' ->
37
+ deep-eq [], lines ''
38
+
39
+ test 'string as input' ->
40
+ deep-eq <[ one two three ]>, lines 'one\ntwo\nthree'
41
+
42
+ suite 'unlines' ->
43
+ test 'empty array as input' ->
44
+ eq '', unlines []
45
+
46
+ test 'array as input' ->
47
+ eq 'one\ntwo\nthree', unlines [\one \two \three]
48
+
49
+ suite 'words' ->
50
+ test 'empty string as input' ->
51
+ deep-eq [], words ''
52
+
53
+ test 'string as input' ->
54
+ deep-eq <[ what is this ]>, words 'what is this'
55
+
56
+ suite 'unwords' ->
57
+ test 'empty array as input' ->
58
+ eq '', unwords []
59
+
60
+ test 'array as input' ->
61
+ eq 'what is this', unwords [\what \is \this]
62
+
63
+ suite 'chars' ->
64
+ test 'empty string as input' ->
65
+ deep-eq [], chars ''
66
+
67
+ test 'string as input' ->
68
+ deep-eq <[ h e l l o ]>, chars 'hello'
69
+
70
+ suite 'unchars' ->
71
+ test 'empty array as input' ->
72
+ eq '', unchars []
73
+
74
+ test 'array as input' ->
75
+ eq 'there', unchars ['t', 'h', 'e', 'r', 'e']
76
+
77
+ suite 'empty' ->
78
+ test 'empty string as input' ->
79
+ ok empty ''
80
+
81
+ test 'string as input' ->
82
+ ok not empty 'a'
83
+
84
+ suite 'reverse' ->
85
+ test 'empty string as input' ->
86
+ eq '', reverse ''
87
+
88
+ test 'a string' ->
89
+ eq 'cba', reverse 'abc'
90
+ eq 'olleh', reverse 'hello'
91
+
92
+ suite 'repeat' ->
93
+ test 'zero times' ->
94
+ eq '' repeat 0 'hi'
95
+
96
+ test 'empty string as input' ->
97
+ eq '', repeat 2 ''
98
+
99
+ test 'a string several times' ->
100
+ eq 'aa', repeat 2 'a'
101
+ eq 'hihihi', repeat 3 'hi'
102
+
103
+ test 'curried' ->
104
+ f = repeat 2
105
+ eq 'aa', f 'a'
106
+
107
+ suite 'slice' ->
108
+ test 'zero to zero' ->
109
+ eq '', slice 0 0 'hello'
110
+
111
+ test 'empty string as input' ->
112
+ eq '', slice 2 3 ''
113
+
114
+ test 'parts' ->
115
+ eq 'll', slice 2 4 'hello'
116
+
117
+ test 'curried' ->
118
+ f = slice 2
119
+ eq 'll', f 4 'hello'
120
+
121
+ g = slice 2 4
122
+ eq 'll', g 'hello'
123
+
124
+ suite 'take' ->
125
+ test 'empty string as input' ->
126
+ eq '', take 3 ''
127
+
128
+ test 'zero on string' ->
129
+ eq '', take 0 'abcde'
130
+
131
+ test 'string' ->
132
+ eq 'ab', take 2 'abcde'
133
+
134
+ test 'curried' ->
135
+ f = take 2
136
+ eq 'ab', f 'abcde'
137
+
138
+ suite 'drop' ->
139
+ test 'empty string as input' ->
140
+ eq '', drop 3 ''
141
+
142
+ test 'zero on string' ->
143
+ eq 'abcde', drop 0 'abcde'
144
+
145
+ test 'string' ->
146
+ eq 'cde', drop 2 'abcde'
147
+
148
+ test 'curried' ->
149
+ f = drop 2
150
+ eq 'cde', f 'abcde'
151
+
152
+ suite 'split-at' ->
153
+ test 'empty string as input' ->
154
+ deep-eq ['', ''], split-at 3 ''
155
+
156
+ test 'zero on string' ->
157
+ deep-eq ['', 'abcde'], split-at 0 'abcde'
158
+
159
+ test 'string' ->
160
+ deep-eq ['ab', 'cde'], split-at 2 'abcde'
161
+
162
+ test 'curried' ->
163
+ f = split-at 2
164
+ deep-eq ['ab', 'cde'], f 'abcde'
165
+
166
+ suite 'take-while' ->
167
+ test 'empty string as input' ->
168
+ eq '', take-while id, ''
169
+
170
+ test 'string' ->
171
+ eq 'mmmmm', take-while (is 'm'), 'mmmmmhmm'
172
+
173
+ test 'curried' ->
174
+ f = take-while (is 'm')
175
+ eq 'mmmmm', f 'mmmmmhmm'
176
+
177
+ suite 'drop-while' ->
178
+ test 'empty string as input' ->
179
+ eq '', drop-while id, ''
180
+
181
+ test 'string' ->
182
+ eq 'hmm', drop-while (is \m), 'mmmmmhmm'
183
+
184
+ test 'curried' ->
185
+ f = drop-while (is \m)
186
+ eq 'hmm', f 'mmmmmhmm'
187
+
188
+ suite 'span' ->
189
+ test 'empty string as input' ->
190
+ deep-eq ['', ''], span id, ''
191
+
192
+ test 'string' ->
193
+ deep-eq ['mmmmm', 'hmm'], span (is \m), 'mmmmmhmm'
194
+
195
+ test 'curried' ->
196
+ f = span (is \m)
197
+ deep-eq ['mmmmm', 'hmm'], f 'mmmmmhmm'
198
+
199
+ suite 'break-str' ->
200
+ test 'empty string as input' ->
201
+ deep-eq ['', ''], break-str id, ''
202
+
203
+ test 'string' ->
204
+ deep-eq ['mmmmm', 'hmm'], break-str (is \h), 'mmmmmhmm'
205
+
206
+ test 'curried' ->
207
+ f = break-str (is \h)
208
+ deep-eq ['mmmmm', 'hmm'], f 'mmmmmhmm'
@@ -0,0 +1,5 @@
1
+ <!doctype html>
2
+ <script src="../browser/prelude-browser.js"></script>
3
+ <script>
4
+ window.prelude = require('prelude-ls');
5
+ </script>