dfect 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/dfect.rb CHANGED
@@ -6,56 +6,158 @@
6
6
  require 'dfect/auto'
7
7
 
8
8
  D 'T()' do
9
- T { true }
9
+ T { true }
10
10
  T { !false }
11
- T { !nil }
11
+ T { !nil }
12
12
 
13
- T { 0 }
13
+ T { 0 } # zero is true in Ruby! :)
14
14
  T { 1 }
15
15
 
16
16
  D 'must return block value' do
17
17
  inner = rand()
18
18
  outer = T { inner }
19
19
 
20
- T { inner == outer }
20
+ T { outer == inner }
21
+ end
22
+ end
23
+
24
+ D 'T!()' do
25
+ T! { !true }
26
+ T! { false }
27
+ T! { nil }
28
+
29
+ D 'must be same as F()' do
30
+ T { D.method(:T!) == D.method(:F) }
31
+ end
32
+ end
33
+
34
+ D 'T?()' do
35
+ T { T? { true } }
36
+ F { T? { false } }
37
+ F { T? { nil } }
38
+
39
+ D 'must not return block value' do
40
+ inner = rand()
41
+ outer = T? { inner }
42
+
43
+ F { outer == inner }
44
+ T { outer == true }
21
45
  end
22
46
  end
23
47
 
24
48
  D 'F()' do
25
49
  F { !true }
26
50
  F { false }
27
- F { nil }
51
+ F { nil }
28
52
 
29
53
  D 'must return block value' do
30
- inner = false
54
+ inner = nil
31
55
  outer = F { inner }
32
56
 
33
- T { inner == outer }
57
+ T { outer == inner }
58
+ end
59
+ end
60
+
61
+ D 'F!()' do
62
+ T! { !true }
63
+ T! { false }
64
+ T! { nil }
65
+
66
+ D 'must be same as T()' do
67
+ T { D.method(:F!) == D.method(:T) }
68
+ end
69
+ end
70
+
71
+ D 'F?()' do
72
+ T { T? { true } }
73
+ F { T? { false } }
74
+ F { T? { nil } }
75
+
76
+ D 'must not return block value' do
77
+ inner = rand()
78
+ outer = F? { inner }
79
+
80
+ F { outer == inner }
81
+ T { outer == false }
34
82
  end
35
83
  end
36
84
 
37
85
  D 'E()' do
38
- E SyntaxError do
39
- raise SyntaxError
86
+ E(SyntaxError) { raise SyntaxError }
87
+
88
+ D 'forbids block to not raise anything' do
89
+ F { E? {} }
40
90
  end
41
91
 
42
- D 'allows nested rescue' do
43
- klass = Class.new(Exception)
92
+ D 'forbids block to raise something unexpected' do
93
+ F { E?(ArgumentError) { raise SyntaxError } }
94
+ end
95
+
96
+ D 'defaults to StandardError when no kinds specified' do
97
+ E { raise StandardError }
98
+ E { raise }
99
+ end
100
+
101
+ D 'does not default to StandardError when kinds are specified' do
102
+ F { E?(SyntaxError) { raise } }
103
+ end
44
104
 
105
+ D 'allows nested rescue' do
45
106
  E SyntaxError do
46
107
  begin
47
- raise ArgumentError
48
- rescue
108
+ raise LoadError
109
+ rescue LoadError
49
110
  end
50
111
 
112
+ raise rescue nil
113
+
51
114
  raise SyntaxError
52
115
  end
53
116
  end
54
117
  end
55
118
 
119
+ D 'E!()' do
120
+ E!(SyntaxError) { raise ArgumentError }
121
+
122
+ D 'allows block to not raise anything' do
123
+ E!(SyntaxError) {}
124
+ end
125
+
126
+ D 'allows block to raise something unexpected' do
127
+ T { not E?(ArgumentError) { raise SyntaxError } }
128
+ end
129
+
130
+ D 'defaults to StandardError when no kinds specified' do
131
+ E! { raise LoadError }
132
+ end
133
+
134
+ D 'does not default to StandardError when kinds are specified' do
135
+ T { not E?(SyntaxError) { raise } }
136
+ end
137
+
138
+ D 'allows nested rescue' do
139
+ E! SyntaxError do
140
+ begin
141
+ raise LoadError
142
+ rescue LoadError
143
+ end
144
+
145
+ raise rescue nil
146
+
147
+ raise ArgumentError
148
+ end
149
+ end
150
+ end
151
+
56
152
  D 'C()' do
57
- C :foo do
58
- throw :foo
153
+ C(:foo) { throw :foo }
154
+
155
+ D 'forbids block to not throw anything' do
156
+ F { C?(:bar) {} }
157
+ end
158
+
159
+ D 'forbids block to throw something unexpected' do
160
+ F { C?(:bar) { throw :foo } }
59
161
  end
60
162
 
61
163
  D 'allows nested catch' do
@@ -67,6 +169,43 @@ D 'C()' do
67
169
  throw :foo
68
170
  end
69
171
  end
172
+
173
+ D 'returns the value thrown along with symbol' do
174
+ inner = rand()
175
+ outer = C(:foo) { throw :foo, inner }
176
+
177
+ T { outer == inner }
178
+ end
179
+ end
180
+
181
+ D 'C!()' do
182
+ C!(:bar) { throw :foo }
183
+
184
+ D 'allows block to not throw anything' do
185
+ C!(:bar) {}
186
+ end
187
+
188
+ D 'allows block to throw something unexpected' do
189
+ T { not C?(:bar) { throw :foo } }
190
+ end
191
+
192
+ D 'allows nested catch' do
193
+ C! :bar do
194
+ catch :moz do
195
+ throw :moz
196
+ end
197
+
198
+ throw :foo
199
+ end
200
+ end
201
+
202
+ D 'does not return the value thrown along with symbol' do
203
+ inner = rand()
204
+ outer = C!(:foo) { throw :bar, inner }
205
+
206
+ F { outer == inner }
207
+ T { outer == nil }
208
+ end
70
209
  end
71
210
 
72
211
  D 'D()' do
@@ -140,6 +279,20 @@ D 'D()' do
140
279
  end
141
280
  end
142
281
 
282
+ D 'D.<() must allow inheritance checking when called without a block' do
283
+ F { D < Kernel }
284
+ F { D < Object }
285
+ F { D < Module }
286
+ T { D.class == Module }
287
+
288
+ c = Class.new { include D }
289
+ T { c < D }
290
+ end
291
+
292
+ D 'YAML must be able to serialize a class' do
293
+ T { SyntaxError.to_yaml == "--- SyntaxError\n" }
294
+ end
295
+
143
296
  D 'stoping #run' do
144
297
  Dfect.stop
145
298
  raise 'this must not be reached!'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dfect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suraj N. Kurapati
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-13 00:00:00 -07:00
12
+ date: 2009-04-28 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: inochi
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
16
25
  description: Assertion testing library for Ruby
17
26
  email: sunaku@gmail.com
18
27
  executables: []
@@ -22,41 +31,32 @@ extensions: []
22
31
  extra_rdoc_files: []
23
32
 
24
33
  files:
34
+ - CREDITS
25
35
  - rakefile
26
- - test
27
36
  - test/dfect.rb
28
- - lib
29
- - lib/dfect
30
37
  - lib/dfect/auto.rb
31
38
  - lib/dfect.rb
32
39
  - LICENSE
33
- - doc
34
40
  - doc/intro.erb
35
41
  - doc/setup.erb
36
- - doc/api/classes
42
+ - doc/index.xhtml
43
+ - doc/api/classes/Class.html
37
44
  - doc/api/classes/Object.html
38
45
  - doc/api/classes/Dfect.html
39
- - doc/api/panel
40
46
  - doc/api/panel/search_index.js
41
47
  - doc/api/panel/tree.js
42
48
  - doc/api/panel/index.html
43
- - doc/api/js
44
49
  - doc/api/js/searchdoc.js
45
50
  - doc/api/js/jquery-effect.js
46
51
  - doc/api/js/jquery-1.3.2.min.js
47
52
  - doc/api/js/main.js
48
- - doc/api/files
53
+ - doc/api/files/CREDITS.html
49
54
  - doc/api/files/LICENSE.html
50
- - doc/api/files/lib
51
55
  - doc/api/files/lib/dfect_rb.html
52
- - doc/api/files/lib/dfect
53
56
  - doc/api/files/lib/dfect/auto_rb.html
54
- - doc/api/files/ANN_txt.html
55
- - doc/api/css
56
57
  - doc/api/css/main.css
57
58
  - doc/api/css/reset.css
58
59
  - doc/api/css/panel.css
59
- - doc/api/i
60
60
  - doc/api/i/arrows.png
61
61
  - doc/api/i/tree_bg.png
62
62
  - doc/api/i/results_bg.png
@@ -67,6 +67,8 @@ files:
67
67
  - doc/index.erb
68
68
  has_rdoc: true
69
69
  homepage: http://snk.tuxfamily.org/lib/dfect
70
+ licenses: []
71
+
70
72
  post_install_message:
71
73
  rdoc_options: []
72
74
 
@@ -87,9 +89,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
89
  requirements: []
88
90
 
89
91
  rubyforge_project: sunaku
90
- rubygems_version: 1.3.1
92
+ rubygems_version: 1.3.2
91
93
  signing_key:
92
- specification_version: 2
94
+ specification_version: 3
93
95
  summary: Assertion testing library for Ruby
94
96
  test_files: []
95
97