test-unit 3.3.3 → 3.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/text/news.md +16 -0
- data/lib/test/unit.rb +129 -120
- data/lib/test/unit/assertions.rb +52 -52
- data/lib/test/unit/data.rb +2 -2
- data/lib/test/unit/notification.rb +9 -7
- data/lib/test/unit/omission.rb +34 -31
- data/lib/test/unit/pending.rb +12 -11
- data/lib/test/unit/testcase.rb +138 -123
- data/lib/test/unit/util/observable.rb +2 -2
- data/lib/test/unit/util/output.rb +5 -4
- data/lib/test/unit/version.rb +1 -1
- data/test/test-assertions.rb +10 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8559bf050780c83fa9e6ff438ac369f279e108300637b4f91766bf16e074b95a
|
4
|
+
data.tar.gz: 250688e7308d7a22110bce25ce3e171fa0dd0cc9d2da828522b8ccefb30ec94e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19e0050adf3340836e1591632b001ac69c995497b37a55eb741d17a469f43d78e4b7160fc030b063ad334d79ea4ad904cadc219ffa6bed8324e3bc3cb83cb83e
|
7
|
+
data.tar.gz: 6e2e87365ac089e6ee0d6ec168340384510be4c6f228f14092b5231731c0a9856077071eff267dd02dd9f81d188391d3a9e2bd29920b351849f786476b333774
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 3.3.4 - 2019-09-30 {#version-3-3-4}
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Converted markup format to Markdown from RDoc.
|
8
|
+
[GitHub#164][Patch by OGAWA KenIchi]
|
9
|
+
|
10
|
+
* test: Stopped to depend on `Time#inspect` format.
|
11
|
+
[GitHub#165][Reported by Benoit Daloze]
|
12
|
+
|
13
|
+
### Thanks
|
14
|
+
|
15
|
+
* OGAWA KenIchi
|
16
|
+
|
17
|
+
* Benoit Daloze
|
18
|
+
|
3
19
|
## 3.3.3 - 2019-05-10 {#version-3-3-3}
|
4
20
|
|
5
21
|
### Fixed
|
data/lib/test/unit.rb
CHANGED
@@ -3,9 +3,9 @@ require 'test/unit/autorunner'
|
|
3
3
|
|
4
4
|
module Test # :nodoc:
|
5
5
|
#
|
6
|
-
#
|
6
|
+
# # Test::Unit - Ruby Unit Testing Framework
|
7
7
|
#
|
8
|
-
#
|
8
|
+
# ## Introduction
|
9
9
|
#
|
10
10
|
# Unit testing is making waves all over the place, largely due to the
|
11
11
|
# fact that it is a core practice of XP. While XP is great, unit testing
|
@@ -24,12 +24,12 @@ module Test # :nodoc:
|
|
24
24
|
# have tests for it.
|
25
25
|
#
|
26
26
|
#
|
27
|
-
#
|
27
|
+
# ## Notes
|
28
28
|
#
|
29
29
|
# Test::Unit has grown out of and superceded Lapidary.
|
30
30
|
#
|
31
31
|
#
|
32
|
-
#
|
32
|
+
# ## Feedback
|
33
33
|
#
|
34
34
|
# I like (and do my best to practice) XP, so I value early releases,
|
35
35
|
# user feedback, and clean, simple, expressive code. There is always
|
@@ -43,7 +43,7 @@ module Test # :nodoc:
|
|
43
43
|
# info is below.
|
44
44
|
#
|
45
45
|
#
|
46
|
-
#
|
46
|
+
# ## Contact Information
|
47
47
|
#
|
48
48
|
# A lot of discussion happens about Ruby in general on the ruby-talk
|
49
49
|
# mailing list (http://www.ruby-lang.org/en/ml.html), and you can ask
|
@@ -53,7 +53,7 @@ module Test # :nodoc:
|
|
53
53
|
# at mailto:testunit@talbott.ws, and I'll do my best to help you out.
|
54
54
|
#
|
55
55
|
#
|
56
|
-
#
|
56
|
+
# ## Credits
|
57
57
|
#
|
58
58
|
# I'd like to thank...
|
59
59
|
#
|
@@ -86,7 +86,7 @@ module Test # :nodoc:
|
|
86
86
|
# My Creator, for giving me life, and giving it more abundantly.
|
87
87
|
#
|
88
88
|
#
|
89
|
-
#
|
89
|
+
# ## License
|
90
90
|
#
|
91
91
|
# Test::Unit is copyright (c) 2000-2003 Nathaniel Talbott. It is free
|
92
92
|
# software, and is distributed under the Ruby license. See the COPYING
|
@@ -98,7 +98,7 @@ module Test # :nodoc:
|
|
98
98
|
# under the Ruby license and/or the PSF license. See the
|
99
99
|
# COPYING file and PSFL file.
|
100
100
|
#
|
101
|
-
#
|
101
|
+
# ## Warranty
|
102
102
|
#
|
103
103
|
# This software is provided "as is" and without any express or
|
104
104
|
# implied warranties, including, without limitation, the implied
|
@@ -106,14 +106,14 @@ module Test # :nodoc:
|
|
106
106
|
# purpose.
|
107
107
|
#
|
108
108
|
#
|
109
|
-
#
|
109
|
+
# ## Author
|
110
110
|
#
|
111
111
|
# Nathaniel Talbott.
|
112
112
|
# Copyright (c) 2000-2003, Nathaniel Talbott
|
113
113
|
#
|
114
114
|
# ----
|
115
115
|
#
|
116
|
-
#
|
116
|
+
# # Usage
|
117
117
|
#
|
118
118
|
# The general idea behind unit testing is that you write a _test_
|
119
119
|
# _method_ that makes certain _assertions_ about your code, working
|
@@ -125,7 +125,7 @@ module Test # :nodoc:
|
|
125
125
|
# pieces.
|
126
126
|
#
|
127
127
|
#
|
128
|
-
#
|
128
|
+
# ## Assertions
|
129
129
|
#
|
130
130
|
# These are the heart of the framework. Think of an assertion as a
|
131
131
|
# statement of expected outcome, i.e. "I assert that x should be equal
|
@@ -137,7 +137,7 @@ module Test # :nodoc:
|
|
137
137
|
# of the current assertions, see Test::Unit::Assertions.
|
138
138
|
#
|
139
139
|
#
|
140
|
-
#
|
140
|
+
# ## Test Method & Test Fixture
|
141
141
|
#
|
142
142
|
# Obviously, these assertions have to be called within a context that
|
143
143
|
# knows about them and can do something meaningful with their
|
@@ -197,7 +197,7 @@ module Test # :nodoc:
|
|
197
197
|
# end
|
198
198
|
#
|
199
199
|
#
|
200
|
-
#
|
200
|
+
# ## Test Runners
|
201
201
|
#
|
202
202
|
# So, now you have this great test class, but you still
|
203
203
|
# need a way to run it and view any failures that occur
|
@@ -208,10 +208,10 @@ module Test # :nodoc:
|
|
208
208
|
# runner simply set default test runner ID to
|
209
209
|
# Test::Unit::AutoRunner:
|
210
210
|
#
|
211
|
-
#
|
212
|
-
#
|
211
|
+
# require 'test/unit'
|
212
|
+
# Test::Unit::AutoRunner.default_runner = "gtk2"
|
213
213
|
#
|
214
|
-
#
|
214
|
+
# ## Test Suite
|
215
215
|
#
|
216
216
|
# As more and more unit tests accumulate for a given project, it
|
217
217
|
# becomes a real drag running them one at a time, and it also
|
@@ -228,17 +228,17 @@ module Test # :nodoc:
|
|
228
228
|
# 'test/unit'. What does this mean? It means you could
|
229
229
|
# write the above test case like this instead:
|
230
230
|
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
231
|
+
# require 'test/unit'
|
232
|
+
# require 'test_myfirsttests'
|
233
|
+
# require 'test_moretestsbyme'
|
234
|
+
# require 'test_anothersetoftests'
|
235
235
|
#
|
236
236
|
# Test::Unit is smart enough to find all the test cases existing in
|
237
237
|
# the ObjectSpace and wrap them up into a suite for you. It then runs
|
238
238
|
# the dynamic suite using the console TestRunner.
|
239
239
|
#
|
240
240
|
#
|
241
|
-
#
|
241
|
+
# ## Configuration file
|
242
242
|
#
|
243
243
|
# Test::Unit reads 'test-unit.yml' in the current working
|
244
244
|
# directory as Test::Unit's configuration file. It can
|
@@ -254,53 +254,58 @@ module Test # :nodoc:
|
|
254
254
|
#
|
255
255
|
# Here are sample color scheme definitions:
|
256
256
|
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
#
|
264
|
-
#
|
265
|
-
#
|
266
|
-
#
|
257
|
+
# color_schemes:
|
258
|
+
# inverted:
|
259
|
+
# success:
|
260
|
+
# name: red
|
261
|
+
# bold: true
|
262
|
+
# failure:
|
263
|
+
# name: green
|
264
|
+
# bold: true
|
265
|
+
# other_scheme:
|
266
|
+
# ...
|
267
267
|
#
|
268
268
|
# Here are the syntax of color scheme definitions:
|
269
269
|
#
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
#
|
281
|
-
# SCHEME_NAME
|
282
|
-
#
|
283
|
-
#
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
270
|
+
# color_schemes:
|
271
|
+
# SCHEME_NAME:
|
272
|
+
# EVENT_NAME:
|
273
|
+
# name: COLOR_NAME
|
274
|
+
# intensity: BOOLEAN
|
275
|
+
# bold: BOOLEAN
|
276
|
+
# italic: BOOLEAN
|
277
|
+
# underline: BOOLEAN
|
278
|
+
# ...
|
279
|
+
# ...
|
280
|
+
#
|
281
|
+
# SCHEME_NAME
|
282
|
+
# : the name of the color scheme
|
283
|
+
#
|
284
|
+
# EVENT_NAME
|
285
|
+
# : one of [success, failure, pending, omission, notification, error]
|
286
|
+
#
|
287
|
+
# COLOR_NAME
|
288
|
+
# : one of [black, red, green, yellow, blue, magenta, cyan, white]
|
289
|
+
#
|
290
|
+
# BOOLEAN
|
291
|
+
# : true or false
|
287
292
|
#
|
288
293
|
# You can use the above 'inverted' color scheme with the
|
289
294
|
# following configuration:
|
290
295
|
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
#
|
296
|
+
# runner: console
|
297
|
+
# console_options:
|
298
|
+
# color_scheme: inverted
|
299
|
+
# color_schemes:
|
300
|
+
# inverted:
|
301
|
+
# success:
|
302
|
+
# name: red
|
303
|
+
# bold: true
|
304
|
+
# failure:
|
305
|
+
# name: green
|
306
|
+
# bold: true
|
302
307
|
#
|
303
|
-
#
|
308
|
+
# ## Questions?
|
304
309
|
#
|
305
310
|
# I'd really like to get feedback from all levels of Ruby
|
306
311
|
# practitioners about typos, grammatical errors, unclear statements,
|
@@ -331,51 +336,53 @@ module Test # :nodoc:
|
|
331
336
|
# To register multiple hooks, call this method multiple times.
|
332
337
|
#
|
333
338
|
# Here is an example test case:
|
334
|
-
# Test::Unit.at_start do
|
335
|
-
# # ...
|
336
|
-
# end
|
337
|
-
#
|
338
|
-
# class TestMyClass1 < Test::Unit::TestCase
|
339
|
-
# class << self
|
340
|
-
# def startup
|
341
|
-
# # ...
|
342
|
-
# end
|
343
|
-
# end
|
344
339
|
#
|
345
|
-
#
|
340
|
+
# Test::Unit.at_start do
|
346
341
|
# # ...
|
347
342
|
# end
|
348
343
|
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
344
|
+
# class TestMyClass1 < Test::Unit::TestCase
|
345
|
+
# class << self
|
346
|
+
# def startup
|
347
|
+
# # ...
|
348
|
+
# end
|
349
|
+
# end
|
352
350
|
#
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
# end
|
351
|
+
# def setup
|
352
|
+
# # ...
|
353
|
+
# end
|
357
354
|
#
|
358
|
-
#
|
359
|
-
# class << self
|
360
|
-
# def startup
|
355
|
+
# def test_my_class1
|
361
356
|
# # ...
|
362
357
|
# end
|
363
|
-
# end
|
364
358
|
#
|
365
|
-
#
|
366
|
-
#
|
359
|
+
# def test_my_class2
|
360
|
+
# # ...
|
361
|
+
# end
|
367
362
|
# end
|
368
363
|
#
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
364
|
+
# class TestMyClass2 < Test::Unit::TestCase
|
365
|
+
# class << self
|
366
|
+
# def startup
|
367
|
+
# # ...
|
368
|
+
# end
|
369
|
+
# end
|
372
370
|
#
|
373
|
-
#
|
374
|
-
#
|
371
|
+
# def setup
|
372
|
+
# # ...
|
373
|
+
# end
|
374
|
+
#
|
375
|
+
# def test_my_class1
|
376
|
+
# # ...
|
377
|
+
# end
|
378
|
+
#
|
379
|
+
# def test_my_class2
|
380
|
+
# # ...
|
381
|
+
# end
|
375
382
|
# end
|
376
|
-
# end
|
377
383
|
#
|
378
384
|
# Here is a call order:
|
385
|
+
#
|
379
386
|
# * at_start
|
380
387
|
# * TestMyClass1.startup
|
381
388
|
# * TestMyClass1#setup
|
@@ -415,51 +422,53 @@ module Test # :nodoc:
|
|
415
422
|
# To register multiple hooks, call this method multiple times.
|
416
423
|
#
|
417
424
|
# Here is an example test case:
|
418
|
-
# Test::Unit.at_exit do
|
419
|
-
# # ...
|
420
|
-
# end
|
421
|
-
#
|
422
|
-
# class TestMyClass1 < Test::Unit::TestCase
|
423
|
-
# class << self
|
424
|
-
# def shutdown
|
425
|
-
# # ...
|
426
|
-
# end
|
427
|
-
# end
|
428
425
|
#
|
429
|
-
#
|
426
|
+
# Test::Unit.at_exit do
|
430
427
|
# # ...
|
431
428
|
# end
|
432
429
|
#
|
433
|
-
#
|
434
|
-
#
|
435
|
-
#
|
430
|
+
# class TestMyClass1 < Test::Unit::TestCase
|
431
|
+
# class << self
|
432
|
+
# def shutdown
|
433
|
+
# # ...
|
434
|
+
# end
|
435
|
+
# end
|
436
436
|
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
# end
|
437
|
+
# def teardown
|
438
|
+
# # ...
|
439
|
+
# end
|
441
440
|
#
|
442
|
-
#
|
443
|
-
# class << self
|
444
|
-
# def shutdown
|
441
|
+
# def test_my_class1
|
445
442
|
# # ...
|
446
443
|
# end
|
447
|
-
# end
|
448
444
|
#
|
449
|
-
#
|
450
|
-
#
|
445
|
+
# def test_my_class2
|
446
|
+
# # ...
|
447
|
+
# end
|
451
448
|
# end
|
452
449
|
#
|
453
|
-
#
|
454
|
-
#
|
455
|
-
#
|
450
|
+
# class TestMyClass2 < Test::Unit::TestCase
|
451
|
+
# class << self
|
452
|
+
# def shutdown
|
453
|
+
# # ...
|
454
|
+
# end
|
455
|
+
# end
|
456
456
|
#
|
457
|
-
#
|
458
|
-
#
|
457
|
+
# def teardown
|
458
|
+
# # ...
|
459
|
+
# end
|
460
|
+
#
|
461
|
+
# def test_my_class1
|
462
|
+
# # ...
|
463
|
+
# end
|
464
|
+
#
|
465
|
+
# def test_my_class2
|
466
|
+
# # ...
|
467
|
+
# end
|
459
468
|
# end
|
460
|
-
# end
|
461
469
|
#
|
462
470
|
# Here is a call order:
|
471
|
+
#
|
463
472
|
# * TestMyClass1#test_my_class1
|
464
473
|
# * TestMyClass1#teardown
|
465
474
|
# * TestMyClass1#test_my_class2
|
data/lib/test/unit/assertions.rb
CHANGED
@@ -171,7 +171,7 @@ module Test
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
-
# Asserts that
|
174
|
+
# Asserts that `object` is false or nil.
|
175
175
|
#
|
176
176
|
# @note Just for minitest compatibility. :<
|
177
177
|
#
|
@@ -213,7 +213,7 @@ module Test
|
|
213
213
|
end
|
214
214
|
|
215
215
|
##
|
216
|
-
# Passes if
|
216
|
+
# Passes if `expected` == `actual`.
|
217
217
|
#
|
218
218
|
# Note that the ordering of arguments is important, since a helpful
|
219
219
|
# error message is generated when this one fails that tells you the
|
@@ -314,7 +314,7 @@ EOT
|
|
314
314
|
|
315
315
|
|
316
316
|
##
|
317
|
-
# Passes if
|
317
|
+
# Passes if `object`.instance_of?(`klass`). When `klass` is
|
318
318
|
# an array of classes, it passes if any class
|
319
319
|
# satisfies +object.instance_of?(class).
|
320
320
|
#
|
@@ -348,8 +348,8 @@ EOT
|
|
348
348
|
end
|
349
349
|
|
350
350
|
##
|
351
|
-
# Passes if
|
352
|
-
# When
|
351
|
+
# Passes if `object`.instance_of?(`klass`) does not hold.
|
352
|
+
# When `klass` is an array of classes, it passes if no class
|
353
353
|
# satisfies +object.instance_of?(class).
|
354
354
|
#
|
355
355
|
# @example
|
@@ -389,7 +389,7 @@ EOT
|
|
389
389
|
alias_method :refute_instance_of, :assert_not_instance_of
|
390
390
|
|
391
391
|
##
|
392
|
-
# Passes if
|
392
|
+
# Passes if `object` is nil.
|
393
393
|
#
|
394
394
|
# @example
|
395
395
|
# assert_nil [1, 2].uniq!
|
@@ -401,7 +401,7 @@ EOT
|
|
401
401
|
end
|
402
402
|
|
403
403
|
##
|
404
|
-
# Passes if
|
404
|
+
# Passes if `object`.kind_of?(`klass`). When `klass` is
|
405
405
|
# an array of classes or modules, it passes if any
|
406
406
|
# class or module satisfies +object.kind_of?(class_or_module).
|
407
407
|
#
|
@@ -437,8 +437,8 @@ EOT
|
|
437
437
|
end
|
438
438
|
|
439
439
|
##
|
440
|
-
# Passes if
|
441
|
-
# When
|
440
|
+
# Passes if `object`.kind_of?(`klass`) does not hold.
|
441
|
+
# When `klass` is an array of classes or modules, it passes only if all
|
442
442
|
# classes (and modules) do not satisfy +object.kind_of?(class_or_module).
|
443
443
|
#
|
444
444
|
# @example
|
@@ -478,7 +478,7 @@ EOT
|
|
478
478
|
alias_method :refute_kind_of, :assert_not_kind_of
|
479
479
|
|
480
480
|
##
|
481
|
-
# Passes if
|
481
|
+
# Passes if `object` .respond_to? `method`
|
482
482
|
#
|
483
483
|
# @example
|
484
484
|
# assert_respond_to 'bugbear', :slice
|
@@ -500,7 +500,7 @@ EOT
|
|
500
500
|
end
|
501
501
|
|
502
502
|
##
|
503
|
-
# Passes if
|
503
|
+
# Passes if `object` does not .respond_to? `method`.
|
504
504
|
#
|
505
505
|
# @example
|
506
506
|
# assert_not_respond_to('bugbear', :nonexistence) # -> pass
|
@@ -528,7 +528,7 @@ EOT
|
|
528
528
|
alias_method :refute_respond_to, :assert_not_respond_to
|
529
529
|
|
530
530
|
##
|
531
|
-
# Passes if
|
531
|
+
# Passes if `pattern` =~ `string`.
|
532
532
|
#
|
533
533
|
# @example
|
534
534
|
# assert_match(/\d+/, 'five, 6, seven')
|
@@ -548,7 +548,7 @@ EOT
|
|
548
548
|
end
|
549
549
|
|
550
550
|
##
|
551
|
-
# Passes if
|
551
|
+
# Passes if `actual` .equal? `expected` (i.e. they are the same
|
552
552
|
# instance).
|
553
553
|
#
|
554
554
|
# @example
|
@@ -565,7 +565,7 @@ EOT
|
|
565
565
|
end
|
566
566
|
|
567
567
|
##
|
568
|
-
# Compares the
|
568
|
+
# Compares the `object1` with `object2` using `operator`.
|
569
569
|
#
|
570
570
|
# Passes if object1.__send__(operator, object2) is true.
|
571
571
|
#
|
@@ -585,7 +585,7 @@ EOT
|
|
585
585
|
end
|
586
586
|
|
587
587
|
##
|
588
|
-
# Compares the
|
588
|
+
# Compares the `object1` with `object2` using `operator`.
|
589
589
|
#
|
590
590
|
# Passes if object1.__send__(operator, object2) is not true.
|
591
591
|
#
|
@@ -652,7 +652,7 @@ EOT
|
|
652
652
|
end
|
653
653
|
|
654
654
|
##
|
655
|
-
# Passes if !
|
655
|
+
# Passes if ! `actual` .equal? `expected`
|
656
656
|
#
|
657
657
|
# @example
|
658
658
|
# assert_not_same Object.new, Object.new
|
@@ -672,7 +672,7 @@ EOT
|
|
672
672
|
alias_method :refute_same, :assert_not_same
|
673
673
|
|
674
674
|
##
|
675
|
-
# Passes if
|
675
|
+
# Passes if `expected` != `actual`
|
676
676
|
#
|
677
677
|
# @example
|
678
678
|
# assert_not_equal 'some string', 5
|
@@ -689,7 +689,7 @@ EOT
|
|
689
689
|
alias_method :refute_equal, :assert_not_equal
|
690
690
|
|
691
691
|
##
|
692
|
-
# Passes if !
|
692
|
+
# Passes if ! `object` .nil?
|
693
693
|
#
|
694
694
|
# @example
|
695
695
|
# assert_not_nil '1 two 3'.sub!(/two/, '2')
|
@@ -706,7 +706,7 @@ EOT
|
|
706
706
|
alias_method :refute_nil, :assert_not_nil
|
707
707
|
|
708
708
|
##
|
709
|
-
# Passes if
|
709
|
+
# Passes if `regexp` !~ `string`
|
710
710
|
#
|
711
711
|
# @example
|
712
712
|
# assert_not_match(/two/, 'one 2 three') # -> pass
|
@@ -731,7 +731,7 @@ EOT
|
|
731
731
|
##
|
732
732
|
# Deprecated. Use #assert_not_match instead.
|
733
733
|
#
|
734
|
-
# Passes if
|
734
|
+
# Passes if `regexp` !~ `string`
|
735
735
|
#
|
736
736
|
# @example
|
737
737
|
# assert_no_match(/two/, 'one 2 three') # -> pass
|
@@ -789,7 +789,7 @@ EOT
|
|
789
789
|
end
|
790
790
|
|
791
791
|
##
|
792
|
-
# Passes if the block throws
|
792
|
+
# Passes if the block throws `expected_object`
|
793
793
|
#
|
794
794
|
# @example
|
795
795
|
# assert_throw(:done) do
|
@@ -860,8 +860,8 @@ EOT
|
|
860
860
|
end
|
861
861
|
|
862
862
|
##
|
863
|
-
# Passes if
|
864
|
-
# within
|
863
|
+
# Passes if `expected_float` and `actual_float` are equal
|
864
|
+
# within `delta` tolerance.
|
865
865
|
#
|
866
866
|
# @example
|
867
867
|
# assert_in_delta 0.05, (50000.0 / 10**6), 0.00001
|
@@ -881,8 +881,8 @@ EOT
|
|
881
881
|
end
|
882
882
|
|
883
883
|
##
|
884
|
-
# Passes if
|
885
|
-
# not equal within
|
884
|
+
# Passes if `expected_float` and `actual_float` are
|
885
|
+
# not equal within `delta` tolerance.
|
886
886
|
#
|
887
887
|
# @example
|
888
888
|
# assert_not_in_delta(0.05, (50000.0 / 10**6), 0.00002) # -> pass
|
@@ -981,8 +981,8 @@ EOT
|
|
981
981
|
|
982
982
|
public
|
983
983
|
##
|
984
|
-
# Passes if
|
985
|
-
# within
|
984
|
+
# Passes if `expected_float` and `actual_float` are equal
|
985
|
+
# within `epsilon` relative error of `expected_float`.
|
986
986
|
#
|
987
987
|
# @example
|
988
988
|
# assert_in_epsilon(10000.0, 9900.0, 0.1) # -> pass
|
@@ -1011,9 +1011,9 @@ EOT
|
|
1011
1011
|
end
|
1012
1012
|
|
1013
1013
|
##
|
1014
|
-
# Passes if
|
1015
|
-
# not equal within
|
1016
|
-
#
|
1014
|
+
# Passes if `expected_float` and `actual_float` are
|
1015
|
+
# not equal within `epsilon` relative error of
|
1016
|
+
# `expected_float`.
|
1017
1017
|
#
|
1018
1018
|
# @example
|
1019
1019
|
# assert_not_in_epsilon(10000.0, 9900.0, 0.1) # -> fail
|
@@ -1121,7 +1121,7 @@ EOT
|
|
1121
1121
|
##
|
1122
1122
|
# Passes if the method send returns a true value.
|
1123
1123
|
#
|
1124
|
-
#
|
1124
|
+
# `send_array` is composed of:
|
1125
1125
|
# * A receiver
|
1126
1126
|
# * A method
|
1127
1127
|
# * Arguments to the method
|
@@ -1161,7 +1161,7 @@ EOT
|
|
1161
1161
|
##
|
1162
1162
|
# Passes if the method send doesn't return a true value.
|
1163
1163
|
#
|
1164
|
-
#
|
1164
|
+
# `send_array` is composed of:
|
1165
1165
|
# * A receiver
|
1166
1166
|
# * A method
|
1167
1167
|
# * Arguments to the method
|
@@ -1199,7 +1199,7 @@ EOT
|
|
1199
1199
|
end
|
1200
1200
|
|
1201
1201
|
##
|
1202
|
-
# Passes if
|
1202
|
+
# Passes if `actual` is a boolean value.
|
1203
1203
|
#
|
1204
1204
|
# @example
|
1205
1205
|
# assert_boolean(true) # -> pass
|
@@ -1215,7 +1215,7 @@ EOT
|
|
1215
1215
|
end
|
1216
1216
|
|
1217
1217
|
##
|
1218
|
-
# Passes if
|
1218
|
+
# Passes if `actual` is true.
|
1219
1219
|
#
|
1220
1220
|
# @example
|
1221
1221
|
# assert_true(true) # -> pass
|
@@ -1231,7 +1231,7 @@ EOT
|
|
1231
1231
|
end
|
1232
1232
|
|
1233
1233
|
##
|
1234
|
-
# Passes if
|
1234
|
+
# Passes if `actual` is false.
|
1235
1235
|
#
|
1236
1236
|
# @example
|
1237
1237
|
# assert_false(false) # -> pass
|
@@ -1247,8 +1247,8 @@ EOT
|
|
1247
1247
|
end
|
1248
1248
|
|
1249
1249
|
##
|
1250
|
-
# Passes if expression "
|
1251
|
-
#
|
1250
|
+
# Passes if expression "`expected` `operator`
|
1251
|
+
# `actual`" is true.
|
1252
1252
|
#
|
1253
1253
|
# @example
|
1254
1254
|
# assert_compare(1, "<", 10) # -> pass
|
@@ -1303,7 +1303,7 @@ EOT
|
|
1303
1303
|
|
1304
1304
|
##
|
1305
1305
|
# Passes if an exception is raised in block and its
|
1306
|
-
# message is
|
1306
|
+
# message is `expected`.
|
1307
1307
|
#
|
1308
1308
|
# @example
|
1309
1309
|
# assert_raise_message("exception") {raise "exception"} # -> pass
|
@@ -1343,7 +1343,7 @@ EOT
|
|
1343
1343
|
end
|
1344
1344
|
|
1345
1345
|
##
|
1346
|
-
# Passes if
|
1346
|
+
# Passes if `object`.const_defined?(`constant_name`)
|
1347
1347
|
#
|
1348
1348
|
# @example
|
1349
1349
|
# assert_const_defined(Test, :Unit) # -> pass
|
@@ -1360,7 +1360,7 @@ EOT
|
|
1360
1360
|
end
|
1361
1361
|
|
1362
1362
|
##
|
1363
|
-
# Passes if
|
1363
|
+
# Passes if !`object`.const_defined?(`constant_name`)
|
1364
1364
|
#
|
1365
1365
|
# @example
|
1366
1366
|
# assert_not_const_defined(Object, :Nonexistent) # -> pass
|
@@ -1377,7 +1377,7 @@ EOT
|
|
1377
1377
|
end
|
1378
1378
|
|
1379
1379
|
##
|
1380
|
-
# Passes if
|
1380
|
+
# Passes if `object`.`predicate` is _true_.
|
1381
1381
|
#
|
1382
1382
|
# @example
|
1383
1383
|
# assert_predicate([], :empty?) # -> pass
|
@@ -1399,7 +1399,7 @@ EOT
|
|
1399
1399
|
end
|
1400
1400
|
|
1401
1401
|
##
|
1402
|
-
# Passes if
|
1402
|
+
# Passes if `object`.`predicate` is not _true_.
|
1403
1403
|
#
|
1404
1404
|
# @example
|
1405
1405
|
# assert_not_predicate([1], :empty?) # -> pass
|
@@ -1426,8 +1426,8 @@ EOT
|
|
1426
1426
|
alias_method :refute_predicate, :assert_not_predicate
|
1427
1427
|
|
1428
1428
|
##
|
1429
|
-
# Passes if
|
1430
|
-
#
|
1429
|
+
# Passes if `object`#`alias_name` is an alias method of
|
1430
|
+
# `object`#`original_name`.
|
1431
1431
|
#
|
1432
1432
|
# @example
|
1433
1433
|
# assert_alias_method([], :length, :size) # -> pass
|
@@ -1474,7 +1474,7 @@ EOT
|
|
1474
1474
|
end
|
1475
1475
|
|
1476
1476
|
##
|
1477
|
-
# Passes if
|
1477
|
+
# Passes if `path` exists.
|
1478
1478
|
#
|
1479
1479
|
# @example
|
1480
1480
|
# assert_path_exist("/tmp") # -> pass
|
@@ -1492,7 +1492,7 @@ EOT
|
|
1492
1492
|
end
|
1493
1493
|
|
1494
1494
|
##
|
1495
|
-
# Passes if
|
1495
|
+
# Passes if `path` doesn't exist.
|
1496
1496
|
#
|
1497
1497
|
# @example
|
1498
1498
|
# assert_path_not_exist("/nonexistent") # -> pass
|
@@ -1510,7 +1510,7 @@ EOT
|
|
1510
1510
|
end
|
1511
1511
|
|
1512
1512
|
##
|
1513
|
-
# Passes if
|
1513
|
+
# Passes if `collection` includes `object`.
|
1514
1514
|
#
|
1515
1515
|
# @example
|
1516
1516
|
# assert_include([1, 10], 1) # -> pass
|
@@ -1537,7 +1537,7 @@ EOT
|
|
1537
1537
|
alias_method :assert_includes, :assert_include
|
1538
1538
|
|
1539
1539
|
##
|
1540
|
-
# Passes if
|
1540
|
+
# Passes if `collection` doesn't include `object`.
|
1541
1541
|
#
|
1542
1542
|
# @example
|
1543
1543
|
# assert_not_include([1, 10], 5) # -> pass
|
@@ -1569,7 +1569,7 @@ EOT
|
|
1569
1569
|
alias_method :refute_includes, :assert_not_include
|
1570
1570
|
|
1571
1571
|
##
|
1572
|
-
# Passes if
|
1572
|
+
# Passes if `object` is empty.
|
1573
1573
|
#
|
1574
1574
|
# @example
|
1575
1575
|
# assert_empty("") # -> pass
|
@@ -1592,7 +1592,7 @@ EOT
|
|
1592
1592
|
end
|
1593
1593
|
|
1594
1594
|
##
|
1595
|
-
# Passes if
|
1595
|
+
# Passes if `object` is not empty.
|
1596
1596
|
#
|
1597
1597
|
# @example
|
1598
1598
|
# assert_not_empty(" ") # -> pass
|
@@ -1620,8 +1620,8 @@ EOT
|
|
1620
1620
|
alias_method :refute_empty, :assert_not_empty
|
1621
1621
|
|
1622
1622
|
##
|
1623
|
-
# Builds a failure message.
|
1624
|
-
#
|
1623
|
+
# Builds a failure message. `user_message` is added before the
|
1624
|
+
# `template` and `arguments` replaces the '?'s positionally in
|
1625
1625
|
# the template.
|
1626
1626
|
def build_message(user_message, template=nil, *arguments)
|
1627
1627
|
template &&= template.chomp
|