dfect 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,31 +0,0 @@
1
- ##
2
- # Location where project documentation will be uploaded by `inochi pub:doc`.
3
- # This value can utilize any remote/destination syntax supported by `rsync`.
4
- #
5
- :pub_doc_target: ~/www/lib/dfect
6
-
7
- ##
8
- # Options for the `rsync` command used to upload this project's documentation.
9
- #
10
- :pub_doc_options: --verbose --compress --archive --update --delete
11
-
12
- ##
13
- # Arbitrary Ruby code that will configure this project's RubyGem before it
14
- # is built by `inochi gem`. This code has access to a local variable named
15
- # `gem` which holds a Gem::Specification object representing this project.
16
- #
17
- # @example
18
- #
19
- # :gem_spec_logic: |
20
- # # show the Inochi-provided specification for this project's RubyGem
21
- # puts gem
22
- #
23
- # # add files that are outside this project directory to the RubyGem
24
- # gem.files += FileList['/some/outside/**/*.files']
25
- #
26
- # # omit some files in this project's directory from the RubyGem
27
- # gem.files.exclude '{some*files,in_this,project/**/directory}'
28
- #
29
- # # and so on... anything is possible! use your imagination!
30
- #
31
- :gem_spec_logic: |
@@ -1,449 +0,0 @@
1
- require 'dfect'
2
-
3
- D 'T()' do
4
- T { true }
5
- T { !false }
6
- T { !nil }
7
-
8
- T { 0 } # zero is true in Ruby! :)
9
- T { 1 }
10
-
11
- D 'must return block value' do
12
- inner = rand()
13
- outer = T { inner }
14
-
15
- T { outer == inner }
16
- end
17
- end
18
-
19
- D 'T!()' do
20
- T! { !true }
21
- T! { false }
22
- T! { nil }
23
-
24
- D 'must return block value' do
25
- inner = nil
26
- outer = T! { inner }
27
-
28
- T { outer == inner }
29
- end
30
- end
31
-
32
- D 'T?()' do
33
- T { T? { true } }
34
- F { T? { false } }
35
- F { T? { nil } }
36
-
37
- D 'must not return block value' do
38
- inner = rand()
39
- outer = T? { inner }
40
-
41
- F { outer == inner }
42
- T { outer == true }
43
- end
44
- end
45
-
46
- D 'F() must be same as T!()' do
47
- T { D.method(:F) == D.method(:T!) }
48
- end
49
-
50
- D 'F!() must be same as T()' do
51
- T { D.method(:F!) == D.method(:T) }
52
- end
53
-
54
- D 'F?()' do
55
- T { T? { true } }
56
- F { T? { false } }
57
- F { T? { nil } }
58
-
59
- D 'must not return block value' do
60
- inner = rand()
61
- outer = F? { inner }
62
-
63
- F { outer == inner }
64
- T { outer == false }
65
- end
66
- end
67
-
68
- D 'E()' do
69
- E(SyntaxError) { raise SyntaxError }
70
- E(SyntaxError, 'must raise SyntaxError') { raise SyntaxError }
71
-
72
- D 'forbids block to not raise anything' do
73
- F { E? {} }
74
- end
75
-
76
- D 'forbids block to raise something unexpected' do
77
- F { E?(ArgumentError) { raise SyntaxError } }
78
- end
79
-
80
- D 'defaults to StandardError when no kinds specified' do
81
- E { raise StandardError }
82
- E { raise }
83
- end
84
-
85
- D 'does not default to StandardError when kinds are specified' do
86
- F { E?(SyntaxError) { raise } }
87
- end
88
-
89
- D 'allows nested rescue' do
90
- E SyntaxError do
91
- begin
92
- raise LoadError
93
- rescue LoadError
94
- end
95
-
96
- raise rescue nil
97
-
98
- raise SyntaxError
99
- end
100
- end
101
- end
102
-
103
- D 'E!()' do
104
- E!(SyntaxError) { raise ArgumentError }
105
- E!(SyntaxError, 'must not raise SyntaxError') { raise ArgumentError }
106
-
107
- D 'allows block to not raise anything' do
108
- E!(SyntaxError) {}
109
- end
110
-
111
- D 'allows block to raise something unexpected' do
112
- T { not E?(ArgumentError) { raise SyntaxError } }
113
- end
114
-
115
- D 'defaults to StandardError when no kinds specified' do
116
- E! { raise LoadError }
117
- end
118
-
119
- D 'does not default to StandardError when kinds are specified' do
120
- T { not E?(SyntaxError) { raise } }
121
- end
122
-
123
- D 'allows nested rescue' do
124
- E! SyntaxError do
125
- begin
126
- raise LoadError
127
- rescue LoadError
128
- end
129
-
130
- raise rescue nil
131
-
132
- raise ArgumentError
133
- end
134
- end
135
- end
136
-
137
- D 'E?()' do
138
- T E?(SyntaxError) { raise SyntaxError }
139
- T E?(SyntaxError, 'must raise SyntaxError') { raise SyntaxError }
140
- F E?(SyntaxError) { raise ArgumentError }
141
- F E?(SyntaxError, 'must not raise SyntaxError') { raise ArgumentError }
142
- end
143
-
144
- D 'C()' do
145
- C(:foo) { throw :foo }
146
- C(:foo, 'must throw :foo') { throw :foo }
147
-
148
- D 'forbids block to not throw anything' do
149
- F { C?(:bar) {} }
150
- end
151
-
152
- D 'forbids block to throw something unexpected' do
153
- F { C?(:bar) { throw :foo } }
154
- end
155
-
156
- D 'allows nested catch' do
157
- C :foo do
158
- catch :bar do
159
- throw :bar
160
- end
161
-
162
- throw :foo
163
- end
164
- end
165
-
166
- D 'returns the value thrown along with symbol' do
167
- inner = rand()
168
- outer = C(:foo) { throw :foo, inner }
169
-
170
- T { outer == inner }
171
- end
172
- end
173
-
174
- D 'C!()' do
175
- C!(:bar) { throw :foo }
176
- C!(:bar, 'must not throw :bar') { throw :foo }
177
-
178
- D 'allows block to not throw anything' do
179
- C!(:bar) {}
180
- end
181
-
182
- D 'allows block to throw something unexpected' do
183
- T { not C?(:bar) { throw :foo } }
184
- end
185
-
186
- D 'allows nested catch' do
187
- C! :bar do
188
- catch :moz do
189
- throw :moz
190
- end
191
-
192
- throw :foo
193
- end
194
- end
195
-
196
- D 'does not return the value thrown along with symbol' do
197
- inner = rand()
198
- outer = C!(:foo) { throw :bar, inner }
199
-
200
- F { outer == inner }
201
- T { outer == nil }
202
- end
203
- end
204
-
205
- D 'C?()' do
206
- T C?(:foo) { throw :foo }
207
- T C?(:foo, 'must throw :foo') { throw :foo }
208
- F C?(:bar) { throw :foo }
209
- F C?(:bar, 'must not throw :bar') { throw :foo }
210
- end
211
-
212
- D 'D()' do
213
- history = []
214
-
215
- D .<< { history << :before_all }
216
- D .< { history << :before_each }
217
- D .> { history << :after_each }
218
- D .>> { history << :after_all }
219
-
220
- D 'first nesting' do
221
- T { history.select {|x| x == :before_all }.length == 1 }
222
- T { history.select {|x| x == :before_each }.length == 1 }
223
- F { history.select {|x| x == :after_each }.length == 1 }
224
- T { history.select {|x| x == :after_all }.length == 0 }
225
- end
226
-
227
- D 'second nesting' do
228
- T { history.select {|x| x == :before_all }.length == 1 }
229
- T { history.select {|x| x == :before_each }.length == 2 }
230
- T { history.select {|x| x == :after_each }.length == 1 }
231
- T { history.select {|x| x == :after_all }.length == 0 }
232
- end
233
-
234
- D 'third nesting' do
235
- T { history.select {|x| x == :before_all }.length == 1 }
236
- T { history.select {|x| x == :before_each }.length == 3 }
237
- T { history.select {|x| x == :after_each }.length == 2 }
238
- T { history.select {|x| x == :after_all }.length == 0 }
239
- end
240
-
241
- D 'fourth nesting' do
242
- D .<< { history << :nested_before_all }
243
- D .< { history << :nested_before_each }
244
- D .> { history << :nested_after_each }
245
- D .>> { history << :nested_after_all }
246
-
247
- nested_before_each = 0
248
-
249
- D .< do
250
- # outer values remain the same for this nesting
251
- T { history.select {|x| x == :before_all }.length == 1 }
252
- T { history.select {|x| x == :before_each }.length == 4 }
253
- T { history.select {|x| x == :after_each }.length == 3 }
254
- T { history.select {|x| x == :after_all }.length == 0 }
255
-
256
- nested_before_each += 1
257
- T { history.select {|x| x == :nested_before_each }.length == nested_before_each }
258
- end
259
-
260
- D 'first double-nesting' do
261
- T { history.select {|x| x == :nested_before_all }.length == 1 }
262
- T { history.select {|x| x == :nested_before_each }.length == 1 }
263
- F { history.select {|x| x == :nested_after_each }.length == 1 }
264
- T { history.select {|x| x == :nested_after_all }.length == 0 }
265
- end
266
-
267
- D 'second double-nesting' do
268
- T { history.select {|x| x == :nested_before_all }.length == 1 }
269
- T { history.select {|x| x == :nested_before_each }.length == 2 }
270
- T { history.select {|x| x == :nested_after_each }.length == 1 }
271
- T { history.select {|x| x == :nested_after_all }.length == 0 }
272
- end
273
-
274
- D 'third double-nesting' do
275
- T { history.select {|x| x == :nested_before_all }.length == 1 }
276
- T { history.select {|x| x == :nested_before_each }.length == 3 }
277
- T { history.select {|x| x == :nested_after_each }.length == 2 }
278
- T { history.select {|x| x == :nested_after_all }.length == 0 }
279
- end
280
- end
281
- end
282
-
283
- D 'D.<() must allow inheritance checking when called without a block' do
284
- F { D < Kernel }
285
- F { D < Object }
286
- F { D < Module }
287
- T { D.class == Module }
288
-
289
- c = Class.new { include D }
290
- T { c < D }
291
- end
292
-
293
- D 'YAML must be able to serialize a class' do
294
- T { SyntaxError.to_yaml == "--- SyntaxError\n" }
295
- end
296
-
297
- D 'insulated root-level describe' do
298
- @insulated = :insulated
299
- non_closured = :non_closured
300
- end
301
-
302
- closured = :closured
303
-
304
- D 'another insulated root-level describe' do
305
- # without insulation, instance variables
306
- # from previous root-level describe
307
- # environments will spill into this one
308
- F { defined? @insulated }
309
- F { @insulated == :insulated }
310
-
311
- # however, this insulation must
312
- # not prevent closure access to
313
- # surrounding local variables
314
- T { defined? closured }
315
- T { closured == :closured }
316
-
317
- # except local variables defined
318
- # within another insulated environment
319
- F { defined? non_closured }
320
- E(NameError) { non_closured }
321
-
322
- @insulated_again = :insulated_again
323
-
324
- D 'non-insulated nested describe' do
325
- D 'inherits instance variables' do
326
- T { defined? @insulated_again }
327
- T { @insulated_again == :insulated_again }
328
- end
329
-
330
- D 'inherits instance methods' do
331
- E!(NoMethodError) { instance_level_helper_method }
332
- T { instance_level_helper_method == :instance_level_helper_method }
333
- end
334
-
335
- D 'inherits class methods' do
336
- E!(NoMethodError) { self.class_level_helper_method }
337
- T { self.class_level_helper_method == :class_level_helper_method }
338
-
339
- E!(NoMethodError) { class_level_helper_method }
340
- T { class_level_helper_method == self.class_level_helper_method }
341
- end
342
-
343
- @non_insulated_from_nested = :non_insulated_from_nested
344
- end
345
-
346
- D! 'nested but explicitly insulated describe' do
347
- D 'does not inherit instance variables' do
348
- F { defined? @insulated_again }
349
- F { @insulated_again == :insulated_again }
350
- end
351
-
352
- D 'does not inherit instance methods' do
353
- E(NameError) { instance_level_helper_method }
354
- end
355
-
356
- D 'does not inherit class methods' do
357
- E(NoMethodError) { self.class_level_helper_method }
358
- E(NameError) { class_level_helper_method }
359
- end
360
-
361
- @non_insulated_from_nested = 123
362
- end
363
-
364
- D 'another non-insulated nested describe' do
365
- T { defined? @non_insulated_from_nested }
366
- T { @non_insulated_from_nested == :non_insulated_from_nested }
367
- end
368
-
369
- def instance_level_helper_method
370
- :instance_level_helper_method
371
- end
372
-
373
- def self.class_level_helper_method
374
- :class_level_helper_method
375
- end
376
- end
377
-
378
- D 'yet another insulated root-level describe' do
379
- F { defined? @insulated_again }
380
- F { @insulated_again == :insulated_again }
381
-
382
- F { defined? @non_insulated_from_nested }
383
- F { @non_insulated_from_nested == :non_insulated_from_nested }
384
- end
385
-
386
- S :knowledge do
387
- @sharing_is_fun = :share_knowledge
388
- end
389
-
390
- S :money do
391
- @sharing_is_fun = :share_money
392
- end
393
-
394
- D 'share knowledge' do
395
- F { defined? @sharing_is_fun }
396
- S :knowledge
397
- T { defined? @sharing_is_fun }
398
- T { @sharing_is_fun == :share_knowledge }
399
-
400
- F { S? :power }
401
- S! :power do
402
- @sharing_is_fun = :share_power
403
- end
404
- T { S? :power }
405
- end
406
-
407
- D 'share money' do
408
- F { defined? @sharing_is_fun }
409
- S :money
410
- T { defined? @sharing_is_fun }
411
- T { @sharing_is_fun == :share_money }
412
-
413
- S :power
414
- T { defined? @sharing_is_fun }
415
- T { @sharing_is_fun == :share_power }
416
-
417
- D! 'share knowledge inside nested but explicitly insulated describe' do
418
- F { defined? @sharing_is_fun }
419
- S :knowledge
420
- T { defined? @sharing_is_fun }
421
- T { @sharing_is_fun == :share_knowledge }
422
- end
423
- end
424
-
425
- D 're-sharing under a previously shared identifier' do
426
- E ArgumentError, 'must raise an error' do
427
- S :knowledge do
428
- @sharing_is_fun = :overwrite_previous_share
429
- end
430
- end
431
-
432
- F { defined? @sharing_is_fun }
433
- F { @sharing_is_fun == :overwrite_previous_share }
434
- end
435
-
436
- D 'injecting an unshared code block' do
437
- E ArgumentError, 'must raise an error' do
438
- S :foobar
439
- end
440
- end
441
-
442
- E 'injecting shared block outside of a test' do
443
- S :knowledge
444
- end
445
-
446
- D 'stoping #run' do
447
- Dfect.stop
448
- raise 'this must not be reached!'
449
- end