rubyunit 0.3.17 → 0.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5d35957bc44ace4839322331916d2a7bd7e40e9
4
- data.tar.gz: 3aa1001b5357db11dc3101168039128f354c697b
3
+ metadata.gz: d8358c7108fd24be7c907c1748027db67ff3ea08
4
+ data.tar.gz: 3eb106f2c6bbcf4d91abcca12cc9704b5b03d465
5
5
  SHA512:
6
- metadata.gz: 06388c102cf2b807cd11c64ca2d4f05c5158090f71bad93f948f4cfb855a191f028e2c7f9b978bc640679da8cb33373d06e75abe8de1ab0c62e462e323d3f679
7
- data.tar.gz: 2771b688763f6c1d7869802b69932fc2ae399c6daf576cae79efde2f617ab97709ede6af632042204b71e4b2d4ea8edfdb9b866253f7f98bd9d3c05006719181
6
+ metadata.gz: 6bd8fc95b36aa9bd6c116d63f82e77050f0f3f5803b840705be95f21dbe646483bf6134d280c40cb50b3be96278bae7cc3c2bae5f1208a10ad9d7e4c341ff503
7
+ data.tar.gz: ad1b94006882e02ce1dc9b9d9ba3bbbf486de124f12bbb4ccfbd4a5948e70bf7da168474a84f4447e8739af81f53eb0a49779fdeb2a553afaaac1c6044dc8d50
@@ -81,7 +81,7 @@ module RubyUnit
81
81
  # assertNotInclude [1, 2, 3], 2, 'It does, so close' # => fail
82
82
  #
83
83
  def assertNotEmpty object, message = nil
84
- __assert_empty ASSERT_EMPTY_ERROR, object, message do
84
+ __assert_empty ASSERT_NOT_EMPTY_ERROR, object, message do
85
85
  not object.empty?
86
86
  end
87
87
  end
@@ -97,7 +97,7 @@ module RubyUnit
97
97
  ##
98
98
  # Perform empty assertion via block
99
99
  def __assert_empty error, object, message #:nodoc:
100
- raise ArgumentError, "#{object.class} does not respond to :empty?" unless collection.respond_to? :empty?
100
+ raise ArgumentError, "#{object.class} does not respond to :empty?" unless object.respond_to? :empty?
101
101
  __assert_block error, message, {:object=>object} { yield }
102
102
  end
103
103
  end
@@ -100,8 +100,8 @@ module RubyUnit
100
100
  begin
101
101
  yield
102
102
  rescue exception => e
103
- assertEqual pattern, e.message if pattern.is_a? String and pattern.length > 0
104
- assertMatch pattern, e.message if pattern.is_a? Regexp
103
+ assertEqual pattern, e.message, message if pattern.is_a? String and pattern.length > 0
104
+ assertMatch pattern, e.message, message if pattern.is_a? Regexp
105
105
  end
106
106
  e
107
107
  end
data/lib/RubyUnit.rb CHANGED
@@ -13,7 +13,7 @@ module RubyUnit
13
13
 
14
14
  ##
15
15
  # Current RubyUnit version
16
- VERSION = '0.3.17'
16
+ VERSION = '0.3.18'
17
17
 
18
18
  ##
19
19
  # Set debug mode
@@ -45,10 +45,10 @@ module RubyUnit
45
45
  ['TestSuite.rb'] + # Test Suite
46
46
  Dir['tests/**/*.rb'] # TESTS
47
47
 
48
- DESCRIPTION = 'Unit testing and test-driven development are crucial parts of ' +
49
- 'the software development life cycle. This tool is intended to ' +
50
- 'make development and testing in Ruby easier on everyone. RubyUnit ' +
51
- 'is also designed to with a focus on data-driven testing and meta-.' +
48
+ DESCRIPTION = 'Unit testing and test-driven development are crucial parts of ' +
49
+ 'the software development life cycle. This tool is intended to ' +
50
+ 'make development and testing in Ruby easier on everyone. RubyUnit '+
51
+ 'is also designed to with a focus on data-driven testing and meta-' +
52
52
  'programming.'
53
53
  end
54
54
  end
@@ -1,13 +1,365 @@
1
1
  require 'RubyUnit/Assertions'
2
2
 
3
- # Data provider for RubyUnit::TestCase tests
3
+ # Data provider for RubyUnit::Assertions Collections tests
4
4
  require_relative 'data/Collections'
5
5
 
6
6
  module AssertionsTests
7
- #
7
+ ##
8
8
  # Test Case for RubyUnit::Assertions Collections assertions
9
9
  #
10
10
  class TC_Collections < AssertionsTestCase
11
11
  include CollectionsData
12
+
13
+ ##
14
+ # Test assertInclude
15
+ #
16
+ # collection::
17
+ # Collection for assertion
18
+ #
19
+ # value::
20
+ # Value to assert
21
+ #
22
+ def assertIncludeTest collection, value
23
+ assertInclude collection, value
24
+ end
25
+
26
+ ##
27
+ # Test assertInclude failure
28
+ #
29
+ # collection::
30
+ # Collection for assertion
31
+ #
32
+ # value::
33
+ # Value to assert
34
+ #
35
+ def assertIncludeFailTest collection, value
36
+ rescue_assertion /#{ASSERT_INCLUDE_ERROR}/ do
37
+ assertInclude collection, value
38
+ end
39
+ end
40
+
41
+ ##
42
+ # Test assertInclude invalid
43
+ #
44
+ # collection::
45
+ # Collection for assertion
46
+ #
47
+ # value::
48
+ # Value to assert
49
+ #
50
+ def assertIncludeInvalidTest collection, value
51
+ assertRaiseKindOf ArgumentError do
52
+ assertInclude collection, value
53
+ end
54
+ end
55
+
56
+ ##
57
+ # Test assertInclude with message
58
+ #
59
+ # collection::
60
+ # Collection for assertion
61
+ #
62
+ # value::
63
+ # Value to assert
64
+ #
65
+ # message::
66
+ # The assertion message
67
+ #
68
+ def assertIncludeWithMessageTest collection, value, message
69
+ assertInclude collection, value, message
70
+ end
71
+
72
+ ##
73
+ # Test assertInclude failure
74
+ #
75
+ # collection::
76
+ # Collection for assertion
77
+ #
78
+ # value::
79
+ # Value to assert
80
+ #
81
+ # message::
82
+ # The assertion message
83
+ #
84
+ def assertIncludeWithMessageFailTest collection, value, message
85
+ rescue_assertion /#{ASSERT_INCLUDE_ERROR}/, message do
86
+ assertInclude collection, value, message
87
+ end
88
+ end
89
+
90
+ ##
91
+ # Test assertInclude invalid with message
92
+ #
93
+ # collection::
94
+ # Collection for assertion
95
+ #
96
+ # value::
97
+ # Value to assert
98
+ #
99
+ # message::
100
+ # The assertion message
101
+ #
102
+ def assertIncludeWithMessageInvalidTest collection, value, message
103
+ assertRaiseKindOf ArgumentError, message do
104
+ assertInclude collection, value, message
105
+ end
106
+ end
107
+
108
+ ##
109
+ # Test assertNotInclude
110
+ #
111
+ # collection::
112
+ # Collection for assertion
113
+ #
114
+ # value::
115
+ # Value to assert
116
+ #
117
+ def assertNotIncludeTest collection, value
118
+ assertNotInclude collection, value
119
+ end
120
+
121
+ ##
122
+ # Test assertNotInclude failure
123
+ #
124
+ # collection::
125
+ # Collection for assertion
126
+ #
127
+ # value::
128
+ # Value to assert
129
+ #
130
+ def assertNotIncludeFailTest collection, value
131
+ rescue_assertion /#{ASSERT_NOT_INCLUDE_ERROR}/ do
132
+ assertNotInclude collection, value
133
+ end
134
+ end
135
+
136
+ ##
137
+ # Test assertNotInclude invalid
138
+ #
139
+ # collection::
140
+ # Collection for assertion
141
+ #
142
+ # value::
143
+ # Value to assert
144
+ #
145
+ def assertNotIncludeInvalidTest collection, value
146
+ assertRaiseKindOf ArgumentError do
147
+ assertNotInclude collection, value
148
+ end
149
+ end
150
+
151
+ ##
152
+ # Test assertNotInclude with message
153
+ #
154
+ # collection::
155
+ # Collection for assertion
156
+ #
157
+ # message::
158
+ # The assertion message
159
+ #
160
+ # value::
161
+ # Value to assert
162
+ #
163
+ def assertNotIncludeWithMessageTest collection, value, message
164
+ assertNotInclude collection, value, message
165
+ end
166
+
167
+ ##
168
+ # Test assertNotInclude failure
169
+ #
170
+ # collection::
171
+ # Collection for assertion
172
+ #
173
+ # message::
174
+ # The assertion message
175
+ #
176
+ # value::
177
+ # Value to assert
178
+ #
179
+ def assertNotIncludeWithMessageFailTest collection, value, message
180
+ rescue_assertion /#{ASSERT_NOT_INCLUDE_ERROR}/, message do
181
+ assertNotInclude collection, value, message
182
+ end
183
+ end
184
+
185
+ ##
186
+ # Test assertNotInclude invalid with message
187
+ #
188
+ # collection::
189
+ # Collection for assertion
190
+ #
191
+ # message::
192
+ # The assertion message
193
+ #
194
+ # value::
195
+ # Value to assert
196
+ #
197
+ def assertNotIncludeWithMessageInvalidTest collection, value, message
198
+ assertRaiseKindOf ArgumentError, message do
199
+ assertNotInclude collection, value, message
200
+ end
201
+ end
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+ ##
212
+ # Test assertEmpty
213
+ #
214
+ # collection::
215
+ # Collection for assertion
216
+ #
217
+ def assertEmptyTest collection
218
+ assertEmpty collection
219
+ end
220
+
221
+ ##
222
+ # Test assertEmpty failure
223
+ #
224
+ # collection::
225
+ # Collection for assertion
226
+ #
227
+ def assertEmptyFailTest collection
228
+ rescue_assertion /#{ASSERT_EMPTY_ERROR}/ do
229
+ assertEmpty collection
230
+ end
231
+ end
232
+
233
+ ##
234
+ # Test assertEmpty invalid
235
+ #
236
+ # collection::
237
+ # Collection for assertion
238
+ #
239
+ def assertEmptyInvalidTest collection
240
+ assertRaiseKindOf ArgumentError do
241
+ assertEmpty collection
242
+ end
243
+ end
244
+
245
+ ##
246
+ # Test assertEmpty with message
247
+ #
248
+ # collection::
249
+ # Collection for assertion
250
+ #
251
+ # message::
252
+ # The assertion message
253
+ #
254
+ def assertEmptyWithMessageTest collection, message
255
+ assertEmpty collection, message
256
+ end
257
+
258
+ ##
259
+ # Test assertEmpty failure
260
+ #
261
+ # collection::
262
+ # Collection for assertion
263
+ #
264
+ # message::
265
+ # The assertion message
266
+ #
267
+ def assertEmptyWithMessageFailTest collection, message
268
+ rescue_assertion /#{ASSERT_EMPTY_ERROR}/, message do
269
+ assertEmpty collection, message
270
+ end
271
+ end
272
+
273
+ ##
274
+ # Test assertEmpty invalid with message
275
+ #
276
+ # collection::
277
+ # Collection for assertion
278
+ #
279
+ # message::
280
+ # The assertion message
281
+ #
282
+ def assertEmptyWithMessageInvalidTest collection, message
283
+ assertRaiseKindOf ArgumentError, message do
284
+ assertEmpty collection, message
285
+ end
286
+ end
287
+
288
+ ##
289
+ # Test assertNotEmpty
290
+ #
291
+ # collection::
292
+ # Collection for assertion
293
+ #
294
+ def assertNotEmptyTest collection
295
+ assertNotEmpty collection
296
+ end
297
+
298
+ ##
299
+ # Test assertNotEmpty failure
300
+ #
301
+ # collection::
302
+ # Collection for assertion
303
+ #
304
+ def assertNotEmptyFailTest collection
305
+ rescue_assertion /#{ASSERT_NOT_EMPTY_ERROR}/ do
306
+ assertNotEmpty collection
307
+ end
308
+ end
309
+
310
+ ##
311
+ # Test assertNotEmpty invalid
312
+ #
313
+ # collection::
314
+ # Collection for assertion
315
+ #
316
+ def assertNotEmptyInvalidTest collection
317
+ assertRaiseKindOf ArgumentError do
318
+ assertNotEmpty collection
319
+ end
320
+ end
321
+
322
+ ##
323
+ # Test assertNotEmpty with message
324
+ #
325
+ # collection::
326
+ # Collection for assertion
327
+ #
328
+ # message::
329
+ # The assertion message
330
+ #
331
+ def assertNotEmptyWithMessageTest collection, message
332
+ assertNotEmpty collection, message
333
+ end
334
+
335
+ ##
336
+ # Test assertNotEmpty failure
337
+ #
338
+ # collection::
339
+ # Collection for assertion
340
+ #
341
+ # message::
342
+ # The assertion message
343
+ #
344
+ def assertNotEmptyWithMessageFailTest collection, message
345
+ rescue_assertion /#{ASSERT_NOT_EMPTY_ERROR}/, message do
346
+ assertNotEmpty collection, message
347
+ end
348
+ end
349
+
350
+ ##
351
+ # Test assertNotEmpty invalid with message
352
+ #
353
+ # collection::
354
+ # Collection for assertion
355
+ #
356
+ # message::
357
+ # The assertion message
358
+ #
359
+ def assertNotEmptyWithMessageInvalidTest collection, message
360
+ assertRaiseKindOf ArgumentError, message do
361
+ assertNotEmpty collection, message
362
+ end
363
+ end
12
364
  end
13
365
  end
@@ -7,7 +7,135 @@ module AssertionsTests
7
7
  module CollectionsData
8
8
  include ObjectTypes
9
9
 
10
- def includeData
10
+ def assertIncludeData
11
+ [
12
+ # Strings
13
+ [ '', ''],
14
+ [ "Multi\nLine", "\n"],
15
+ [ "Multi\nLine", 'Line'],
16
+ [ 'abcdefg', 'abc'],
17
+ [ 'abcdefg', 'cde'],
18
+ [ 'abcdefg', 'efg'],
19
+ ["#{'abcdefg'}", 'abc'],
20
+ ["#{'abcdefg'}", 'cde'],
21
+ ["#{'abcdefg'}", 'efg'],
22
+ # Ranges
23
+ [ (-5..-1), -5],
24
+ [ (-5..-1), -3],
25
+ [ (-5...-1), -2],
26
+ [ (0..42), 0],
27
+ [ (0..42), 21],
28
+ [ (0...42), 41],
29
+ [ ('a'..'g'), 'a'],
30
+ [ ('a'..'g'), 'e'],
31
+ [('a'...'g'), 'f'],
32
+ # Arrays
33
+ [['String', 42, {:hash=>42}, (0..42), /Regexp/], 'String'],
34
+ [['String', 42, {:hash=>42}, (0..42), /Regexp/], {:hash=>42}],
35
+ [['String', 42, {:hash=>42}, (0..42), /Regexp/], /Regexp/],
36
+ # Hashes
37
+ [{:string=>'String','int'=>42,:regexp=>/Regexp/}, :string],
38
+ [{:string=>'String','int'=>42,:regexp=>/Regexp/}, 'int'],
39
+ [{:string=>'String','int'=>42,:regexp=>/Regexp/}, :regexp],
40
+ ]
11
41
  end
42
+ alias_method :assertNotIncludeFailData, :assertIncludeData
43
+
44
+ def assertIncludeFailData
45
+ [
46
+ # Strings
47
+ [ '', 'ab'],
48
+ [ "Multi\nLine", "\t"],
49
+ [ "Multi\nLine", 'Lines'],
50
+ [ 'abcdefg', 'fgh'],
51
+ ["#{'abcdefg'}", '0'],
52
+ ["#{'abcdefg'}", 'h'],
53
+ # Ranges
54
+ [ (-5..-1), -6],
55
+ [ (-5...-1), -1],
56
+ [ (0..42), -1],
57
+ [ (0...42), 42],
58
+ [ ('a'..'g'), '0'],
59
+ [('a'...'g'), 'g'],
60
+ # Arrays
61
+ [['String', 42, {:hash=>42}, (0..42), /Regexp/], 'Integer'],
62
+ [['String', 42, {:hash=>42}, (0..42), /Regexp/], {:hash=>41}],
63
+ [['String', 42, {:hash=>42}, (0..42), /Regexp/], /^Missing$/],
64
+ # Hashes
65
+ [{:string=>'String','int'=>42,:regexp=>/Regexp/}, :integer],
66
+ [{:string=>'String','int'=>42,:regexp=>/Regexp/}, 'hash'],
67
+ [{:string=>'String','int'=>42,:regexp=>/Regexp/}, Object],
68
+ ]
69
+ end
70
+ alias_method :assertNotIncludeData, :assertIncludeFailData
71
+
72
+ def assertIncludeInvalidData
73
+ add_parameter(fixnumObjects) +
74
+ add_parameter(bignumObjects) +
75
+ add_parameter(floatObjects) +
76
+ add_parameter(rationalObjects) +
77
+ add_parameter(complexObjects) +
78
+ add_parameter(timeObjects) +
79
+ add_parameter(regexpObjects)
80
+ end
81
+ alias_method :assertNotIncludeInvalidData, :assertIncludeInvalidData
82
+
83
+ def assertIncludeWithMessageInvalidData
84
+ add_parameter assertIncludeInvalidData
85
+ end
86
+ alias_method :assertNotIncludeWithMessageInvalidData, :assertIncludeWithMessageInvalidData
87
+
88
+ def assertIncludeWithMessageData
89
+ add_parameter assertIncludeData
90
+ end
91
+ alias_method :assertNotIncludeWithMessageFailData, :assertIncludeWithMessageData
92
+
93
+ def assertIncludeWithMessageFailData
94
+ add_parameter assertIncludeFailData
95
+ end
96
+ alias_method :assertNotIncludeWithMessageData, :assertIncludeWithMessageFailData
97
+
98
+ def assertEmptyData
99
+ [
100
+ [''],
101
+ [[]],
102
+ [{}],
103
+ ]
104
+ end
105
+ alias_method :assertNotEmptyFailData, :assertEmptyData
106
+
107
+ def assertEmptyFailData
108
+ stringObjects - [[""]] +
109
+ arrayObjects - [[[]]] +
110
+ hashObjects - [[{}]]
111
+ end
112
+ alias_method :assertNotEmptyData, :assertEmptyFailData
113
+
114
+ def assertEmptyInvalidData
115
+ fixnumObjects +
116
+ bignumObjects +
117
+ floatObjects +
118
+ rationalObjects +
119
+ complexObjects +
120
+ timeObjects +
121
+ rangeObjects +
122
+ regexpObjects
123
+ end
124
+ alias_method :assertNotEmptyInvalidData, :assertEmptyInvalidData
125
+
126
+ def assertEmptyWithMessageInvalidData
127
+ add_parameter assertEmptyInvalidData
128
+ end
129
+ alias_method :assertNotEmptyWithMessageInvalidData, :assertEmptyWithMessageInvalidData
130
+
131
+ def assertEmptyWithMessageData
132
+ add_parameter assertEmptyData
133
+ end
134
+ alias_method :assertNotEmptyWithMessageFailData, :assertEmptyWithMessageData
135
+
136
+ def assertEmptyWithMessageFailData
137
+ add_parameter assertEmptyFailData
138
+ end
139
+ alias_method :assertNotEmptyWithMessageData, :assertEmptyWithMessageFailData
12
140
  end
13
141
  end
@@ -150,8 +150,9 @@ module AssertionsTests
150
150
 
151
151
  def rangeObjects
152
152
  [
153
- [ (-1..-5)],
153
+ [ (0..0)],
154
154
  [ (-5..-1)],
155
+ [ (0..42)],
155
156
  [ ('a'..'e')],
156
157
  [('a'...'e')],
157
158
  ]
metadata CHANGED
@@ -1,19 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyunit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.17
4
+ version: 0.3.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Clower
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-21 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.1'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.1'
13
27
  description: Unit testing and test-driven development are crucial parts of the software
14
28
  development life cycle. This tool is intended to make development and testing in
15
29
  Ruby easier on everyone. RubyUnit is also designed to with a focus on data-driven
16
- testing and meta-.programming.
30
+ testing and meta-programming.
17
31
  email:
18
32
  - matthewclower@gmail.com
19
33
  executables: []
@@ -93,9 +107,9 @@ require_paths:
93
107
  - lib
94
108
  required_ruby_version: !ruby/object:Gem::Requirement
95
109
  requirements:
96
- - - "~>"
110
+ - - ">="
97
111
  - !ruby/object:Gem::Version
98
- version: '2.0'
112
+ version: 1.9.2
99
113
  required_rubygems_version: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - ">="