minitest 5.11.3 → 5.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.rdoc +187 -4
- data/Manifest.txt +3 -0
- data/README.rdoc +100 -15
- data/Rakefile +4 -16
- data/lib/hoe/minitest.rb +0 -4
- data/lib/minitest/assertions.rb +144 -29
- data/lib/minitest/benchmark.rb +7 -7
- data/lib/minitest/expectations.rb +54 -35
- data/lib/minitest/mock.rb +119 -32
- data/lib/minitest/pride_plugin.rb +1 -1
- data/lib/minitest/spec.rb +27 -9
- data/lib/minitest/test.rb +42 -6
- data/lib/minitest/test_task.rb +305 -0
- data/lib/minitest/unit.rb +5 -8
- data/lib/minitest.rb +133 -42
- data/test/minitest/metametameta.rb +43 -9
- data/test/minitest/test_minitest_assertions.rb +1591 -0
- data/test/minitest/test_minitest_benchmark.rb +2 -2
- data/test/minitest/test_minitest_mock.rb +288 -16
- data/test/minitest/test_minitest_reporter.rb +30 -17
- data/test/minitest/test_minitest_spec.rb +273 -155
- data/test/minitest/test_minitest_test.rb +271 -1141
- data/test/minitest/test_minitest_test_task.rb +46 -0
- data.tar.gz.sig +0 -0
- metadata +35 -22
- metadata.gz.sig +0 -0
data/lib/minitest/assertions.rb
CHANGED
@@ -27,20 +27,18 @@ module Minitest
|
|
27
27
|
# figure out what diff to use.
|
28
28
|
|
29
29
|
def self.diff
|
30
|
+
return @diff if defined? @diff
|
31
|
+
|
30
32
|
@diff = if (RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ &&
|
31
33
|
system("diff.exe", __FILE__, __FILE__)) then
|
32
34
|
"diff.exe -u"
|
33
|
-
elsif Minitest::Test.maglev? then
|
34
|
-
"diff -u"
|
35
35
|
elsif system("gdiff", __FILE__, __FILE__)
|
36
36
|
"gdiff -u" # solaris and kin suck
|
37
37
|
elsif system("diff", __FILE__, __FILE__)
|
38
38
|
"diff -u"
|
39
39
|
else
|
40
40
|
nil
|
41
|
-
end
|
42
|
-
|
43
|
-
@diff
|
41
|
+
end
|
44
42
|
end
|
45
43
|
|
46
44
|
##
|
@@ -55,22 +53,16 @@ module Minitest
|
|
55
53
|
# diff command or if it doesn't make sense to diff the output
|
56
54
|
# (single line, short output), then it simply returns a basic
|
57
55
|
# comparison between the two.
|
56
|
+
#
|
57
|
+
# See +things_to_diff+ for more info.
|
58
58
|
|
59
59
|
def diff exp, act
|
60
|
-
expect = mu_pp_for_diff exp
|
61
|
-
butwas = mu_pp_for_diff act
|
62
60
|
result = nil
|
63
61
|
|
64
|
-
|
65
|
-
(expect.include?("\n") ||
|
66
|
-
butwas.include?("\n") ||
|
67
|
-
expect.size > 30 ||
|
68
|
-
butwas.size > 30 ||
|
69
|
-
expect == butwas) &&
|
70
|
-
Minitest::Assertions.diff
|
62
|
+
expect, butwas = things_to_diff(exp, act)
|
71
63
|
|
72
64
|
return "Expected: #{mu_pp exp}\n Actual: #{mu_pp act}" unless
|
73
|
-
|
65
|
+
expect
|
74
66
|
|
75
67
|
Tempfile.open("expect") do |a|
|
76
68
|
a.puts expect
|
@@ -99,10 +91,40 @@ module Minitest
|
|
99
91
|
result
|
100
92
|
end
|
101
93
|
|
94
|
+
##
|
95
|
+
# Returns things to diff [expect, butwas], or [nil, nil] if nothing to diff.
|
96
|
+
#
|
97
|
+
# Criterion:
|
98
|
+
#
|
99
|
+
# 1. Strings include newlines or escaped newlines, but not both.
|
100
|
+
# 2. or: String lengths are > 30 characters.
|
101
|
+
# 3. or: Strings are equal to each other (but maybe different encodings?).
|
102
|
+
# 4. and: we found a diff executable.
|
103
|
+
|
104
|
+
def things_to_diff exp, act
|
105
|
+
expect = mu_pp_for_diff exp
|
106
|
+
butwas = mu_pp_for_diff act
|
107
|
+
|
108
|
+
e1, e2 = expect.include?("\n"), expect.include?("\\n")
|
109
|
+
b1, b2 = butwas.include?("\n"), butwas.include?("\\n")
|
110
|
+
|
111
|
+
need_to_diff =
|
112
|
+
(e1 ^ e2 ||
|
113
|
+
b1 ^ b2 ||
|
114
|
+
expect.size > 30 ||
|
115
|
+
butwas.size > 30 ||
|
116
|
+
expect == butwas) &&
|
117
|
+
Minitest::Assertions.diff
|
118
|
+
|
119
|
+
need_to_diff && [expect, butwas]
|
120
|
+
end
|
121
|
+
|
102
122
|
##
|
103
123
|
# This returns a human-readable version of +obj+. By default
|
104
|
-
# #inspect is called. You can override this to use #
|
124
|
+
# #inspect is called. You can override this to use #pretty_inspect
|
105
125
|
# if you want.
|
126
|
+
#
|
127
|
+
# See Minitest::Test.make_my_diffs_pretty!
|
106
128
|
|
107
129
|
def mu_pp obj
|
108
130
|
s = obj.inspect
|
@@ -110,8 +132,11 @@ module Minitest
|
|
110
132
|
if defined? Encoding then
|
111
133
|
s = s.encode Encoding.default_external
|
112
134
|
|
113
|
-
if String === obj && obj.encoding != Encoding.default_external
|
114
|
-
|
135
|
+
if String === obj && (obj.encoding != Encoding.default_external ||
|
136
|
+
!obj.valid_encoding?) then
|
137
|
+
enc = "# encoding: #{obj.encoding}"
|
138
|
+
val = "# valid: #{obj.valid_encoding?}"
|
139
|
+
s = "#{enc}\n#{val}\n#{s}"
|
115
140
|
end
|
116
141
|
end
|
117
142
|
|
@@ -119,13 +144,32 @@ module Minitest
|
|
119
144
|
end
|
120
145
|
|
121
146
|
##
|
122
|
-
# This returns a diff-able human-readable version of +obj+.
|
123
|
-
# differs from the regular mu_pp because it expands escaped
|
124
|
-
# newlines and makes hex-values
|
147
|
+
# This returns a diff-able more human-readable version of +obj+.
|
148
|
+
# This differs from the regular mu_pp because it expands escaped
|
149
|
+
# newlines and makes hex-values (like object_ids) generic. This
|
125
150
|
# uses mu_pp to do the first pass and then cleans it up.
|
126
151
|
|
127
152
|
def mu_pp_for_diff obj
|
128
|
-
mu_pp
|
153
|
+
str = mu_pp obj
|
154
|
+
|
155
|
+
# both '\n' & '\\n' (_after_ mu_pp (aka inspect))
|
156
|
+
single = !!str.match(/(?<!\\|^)\\n/)
|
157
|
+
double = !!str.match(/(?<=\\|^)\\n/)
|
158
|
+
|
159
|
+
process =
|
160
|
+
if single ^ double then
|
161
|
+
if single then
|
162
|
+
lambda { |s| s == "\\n" ? "\n" : s } # unescape
|
163
|
+
else
|
164
|
+
lambda { |s| s == "\\\\n" ? "\\n\n" : s } # unescape a bit, add nls
|
165
|
+
end
|
166
|
+
else
|
167
|
+
:itself # leave it alone
|
168
|
+
end
|
169
|
+
|
170
|
+
str.
|
171
|
+
gsub(/\\?\\n/, &process).
|
172
|
+
gsub(/:0x[a-fA-F0-9]{4,}/m, ":0xXXXXXX") # anonymize hex values
|
129
173
|
end
|
130
174
|
|
131
175
|
##
|
@@ -249,6 +293,8 @@ module Minitest
|
|
249
293
|
assert_respond_to matcher, :"=~"
|
250
294
|
matcher = Regexp.new Regexp.escape matcher if String === matcher
|
251
295
|
assert matcher =~ obj, msg
|
296
|
+
|
297
|
+
Regexp.last_match
|
252
298
|
end
|
253
299
|
|
254
300
|
##
|
@@ -283,6 +329,9 @@ module Minitest
|
|
283
329
|
# See also: #assert_silent
|
284
330
|
|
285
331
|
def assert_output stdout = nil, stderr = nil
|
332
|
+
flunk "assert_output requires a block to capture output." unless
|
333
|
+
block_given?
|
334
|
+
|
286
335
|
out, err = capture_io do
|
287
336
|
yield
|
288
337
|
end
|
@@ -294,6 +343,18 @@ module Minitest
|
|
294
343
|
x = send out_msg, stdout, out, "In stdout" if out_msg
|
295
344
|
|
296
345
|
(!stdout || x) && (!stderr || y)
|
346
|
+
rescue Assertion
|
347
|
+
raise
|
348
|
+
rescue => e
|
349
|
+
raise UnexpectedError, e
|
350
|
+
end
|
351
|
+
|
352
|
+
##
|
353
|
+
# Fails unless +path+ exists.
|
354
|
+
|
355
|
+
def assert_path_exists path, msg = nil
|
356
|
+
msg = message(msg) { "Expected path '#{path}' to exist" }
|
357
|
+
assert File.exist?(path), msg
|
297
358
|
end
|
298
359
|
|
299
360
|
##
|
@@ -316,9 +377,26 @@ module Minitest
|
|
316
377
|
#
|
317
378
|
# +exp+ takes an optional message on the end to help explain
|
318
379
|
# failures and defaults to StandardError if no exception class is
|
319
|
-
# passed.
|
380
|
+
# passed. Eg:
|
381
|
+
#
|
382
|
+
# assert_raises(CustomError) { method_with_custom_error }
|
383
|
+
#
|
384
|
+
# With custom error message:
|
385
|
+
#
|
386
|
+
# assert_raises(CustomError, 'This should have raised CustomError') { method_with_custom_error }
|
387
|
+
#
|
388
|
+
# Using the returned object:
|
389
|
+
#
|
390
|
+
# error = assert_raises(CustomError) do
|
391
|
+
# raise CustomError, 'This is really bad'
|
392
|
+
# end
|
393
|
+
#
|
394
|
+
# assert_equal 'This is really bad', error.message
|
320
395
|
|
321
396
|
def assert_raises *exp
|
397
|
+
flunk "assert_raises requires a block to capture errors." unless
|
398
|
+
block_given?
|
399
|
+
|
322
400
|
msg = "#{exp.pop}.\n" if String === exp.last
|
323
401
|
exp << StandardError if exp.empty?
|
324
402
|
|
@@ -327,7 +405,7 @@ module Minitest
|
|
327
405
|
rescue *exp => e
|
328
406
|
pass # count assertion
|
329
407
|
return e
|
330
|
-
rescue Minitest::Skip
|
408
|
+
rescue Minitest::Assertion # incl Skip & UnexpectedError
|
331
409
|
# don't count assertion
|
332
410
|
raise
|
333
411
|
rescue SignalException, SystemExit
|
@@ -397,7 +475,7 @@ module Minitest
|
|
397
475
|
def assert_throws sym, msg = nil
|
398
476
|
default = "Expected #{mu_pp(sym)} to have been thrown"
|
399
477
|
caught = true
|
400
|
-
catch(sym) do
|
478
|
+
value = catch(sym) do
|
401
479
|
begin
|
402
480
|
yield
|
403
481
|
rescue ThreadError => e # wtf?!? 1.8 + threads == suck
|
@@ -413,6 +491,11 @@ module Minitest
|
|
413
491
|
end
|
414
492
|
|
415
493
|
assert caught, message(msg) { default }
|
494
|
+
value
|
495
|
+
rescue Assertion
|
496
|
+
raise
|
497
|
+
rescue => e
|
498
|
+
raise UnexpectedError, e
|
416
499
|
end
|
417
500
|
|
418
501
|
##
|
@@ -481,10 +564,13 @@ module Minitest
|
|
481
564
|
|
482
565
|
return captured_stdout.read, captured_stderr.read
|
483
566
|
ensure
|
484
|
-
captured_stdout.unlink
|
485
|
-
captured_stderr.unlink
|
486
567
|
$stdout.reopen orig_stdout
|
487
568
|
$stderr.reopen orig_stderr
|
569
|
+
|
570
|
+
orig_stdout.close
|
571
|
+
orig_stderr.close
|
572
|
+
captured_stdout.close!
|
573
|
+
captured_stderr.close!
|
488
574
|
end
|
489
575
|
end
|
490
576
|
end
|
@@ -504,7 +590,16 @@ module Minitest
|
|
504
590
|
end
|
505
591
|
|
506
592
|
##
|
507
|
-
# Fails
|
593
|
+
# Fails after a given date (in the local time zone). This allows
|
594
|
+
# you to put time-bombs in your tests if you need to keep
|
595
|
+
# something around until a later date lest you forget about it.
|
596
|
+
|
597
|
+
def fail_after y,m,d,msg
|
598
|
+
flunk msg if Time.now > Time.local(y, m, d)
|
599
|
+
end
|
600
|
+
|
601
|
+
##
|
602
|
+
# Fails with +msg+.
|
508
603
|
|
509
604
|
def flunk msg = nil
|
510
605
|
msg ||= "Epic Fail!"
|
@@ -534,7 +629,7 @@ module Minitest
|
|
534
629
|
|
535
630
|
def refute test, msg = nil
|
536
631
|
msg ||= message { "Expected #{mu_pp(test)} to not be truthy" }
|
537
|
-
|
632
|
+
assert !test, msg
|
538
633
|
end
|
539
634
|
|
540
635
|
##
|
@@ -638,6 +733,14 @@ module Minitest
|
|
638
733
|
refute o1.__send__(op, o2), msg
|
639
734
|
end
|
640
735
|
|
736
|
+
##
|
737
|
+
# Fails if +path+ exists.
|
738
|
+
|
739
|
+
def refute_path_exists path, msg = nil
|
740
|
+
msg = message(msg) { "Expected path '#{path}' to not exist" }
|
741
|
+
refute File.exist?(path), msg
|
742
|
+
end
|
743
|
+
|
641
744
|
##
|
642
745
|
# For testing with predicates.
|
643
746
|
#
|
@@ -683,6 +786,18 @@ module Minitest
|
|
683
786
|
raise Minitest::Skip, msg, bt
|
684
787
|
end
|
685
788
|
|
789
|
+
##
|
790
|
+
# Skips the current run until a given date (in the local time
|
791
|
+
# zone). This allows you to put some fixes on hold until a later
|
792
|
+
# date, but still holds you accountable and prevents you from
|
793
|
+
# forgetting it.
|
794
|
+
|
795
|
+
def skip_until y,m,d,msg
|
796
|
+
skip msg if Time.now < Time.local(y, m, d)
|
797
|
+
where = caller.first.rpartition(':in').reject(&:empty?).first
|
798
|
+
warn "Stale skip_until %p at %s" % [msg, where]
|
799
|
+
end
|
800
|
+
|
686
801
|
##
|
687
802
|
# Was this testcase skipped? Meant for #teardown.
|
688
803
|
|
data/lib/minitest/benchmark.rb
CHANGED
@@ -109,8 +109,8 @@ module Minitest
|
|
109
109
|
# is applied against the slope itself. As such, you probably want
|
110
110
|
# to tighten it from the default.
|
111
111
|
#
|
112
|
-
# See
|
113
|
-
# more details.
|
112
|
+
# See https://www.graphpad.com/guides/prism/8/curve-fitting/reg_intepretingnonlinr2.htm
|
113
|
+
# for more details.
|
114
114
|
#
|
115
115
|
# Fit is calculated by #fit_linear.
|
116
116
|
#
|
@@ -217,7 +217,7 @@ module Minitest
|
|
217
217
|
##
|
218
218
|
# Takes an array of x/y pairs and calculates the general R^2 value.
|
219
219
|
#
|
220
|
-
# See:
|
220
|
+
# See: https://en.wikipedia.org/wiki/Coefficient_of_determination
|
221
221
|
|
222
222
|
def fit_error xys
|
223
223
|
y_bar = sigma(xys) { |_, y| y } / xys.size.to_f
|
@@ -232,7 +232,7 @@ module Minitest
|
|
232
232
|
#
|
233
233
|
# Takes x and y values and returns [a, b, r^2].
|
234
234
|
#
|
235
|
-
# See:
|
235
|
+
# See: https://mathworld.wolfram.com/LeastSquaresFittingExponential.html
|
236
236
|
|
237
237
|
def fit_exponential xs, ys
|
238
238
|
n = xs.size
|
@@ -254,7 +254,7 @@ module Minitest
|
|
254
254
|
#
|
255
255
|
# Takes x and y values and returns [a, b, r^2].
|
256
256
|
#
|
257
|
-
# See:
|
257
|
+
# See: https://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.html
|
258
258
|
|
259
259
|
def fit_logarithmic xs, ys
|
260
260
|
n = xs.size
|
@@ -276,7 +276,7 @@ module Minitest
|
|
276
276
|
#
|
277
277
|
# Takes x and y values and returns [a, b, r^2].
|
278
278
|
#
|
279
|
-
# See:
|
279
|
+
# See: https://mathworld.wolfram.com/LeastSquaresFitting.html
|
280
280
|
|
281
281
|
def fit_linear xs, ys
|
282
282
|
n = xs.size
|
@@ -298,7 +298,7 @@ module Minitest
|
|
298
298
|
#
|
299
299
|
# Takes x and y values and returns [a, b, r^2].
|
300
300
|
#
|
301
|
-
# See:
|
301
|
+
# See: https://mathworld.wolfram.com/LeastSquaresFittingPowerLaw.html
|
302
302
|
|
303
303
|
def fit_power xs, ys
|
304
304
|
n = xs.size
|
@@ -9,10 +9,11 @@
|
|
9
9
|
#
|
10
10
|
# it "should still work in threads" do
|
11
11
|
# my_threaded_thingy do
|
12
|
-
# (1+1).must_equal 2
|
13
|
-
# assert_equal 2, 1+1
|
14
|
-
# _(1 + 1).must_equal 2
|
15
|
-
# value(1 + 1).must_equal 2
|
12
|
+
# (1+1).must_equal 2 # bad
|
13
|
+
# assert_equal 2, 1+1 # good
|
14
|
+
# _(1 + 1).must_equal 2 # good
|
15
|
+
# value(1 + 1).must_equal 2 # good, also #expect
|
16
|
+
# _ { 1 + "1" }.must_raise TypeError # good
|
16
17
|
# end
|
17
18
|
# end
|
18
19
|
|
@@ -21,7 +22,7 @@ module Minitest::Expectations
|
|
21
22
|
##
|
22
23
|
# See Minitest::Assertions#assert_empty.
|
23
24
|
#
|
24
|
-
# collection.must_be_empty
|
25
|
+
# _(collection).must_be_empty
|
25
26
|
#
|
26
27
|
# :method: must_be_empty
|
27
28
|
|
@@ -30,7 +31,7 @@ module Minitest::Expectations
|
|
30
31
|
##
|
31
32
|
# See Minitest::Assertions#assert_equal
|
32
33
|
#
|
33
|
-
# a.must_equal b
|
34
|
+
# _(a).must_equal b
|
34
35
|
#
|
35
36
|
# :method: must_equal
|
36
37
|
|
@@ -39,18 +40,18 @@ module Minitest::Expectations
|
|
39
40
|
##
|
40
41
|
# See Minitest::Assertions#assert_in_delta
|
41
42
|
#
|
42
|
-
# n.must_be_close_to m [, delta]
|
43
|
+
# _(n).must_be_close_to m [, delta]
|
43
44
|
#
|
44
45
|
# :method: must_be_close_to
|
45
46
|
|
46
47
|
infect_an_assertion :assert_in_delta, :must_be_close_to
|
47
48
|
|
48
|
-
|
49
|
+
infect_an_assertion :assert_in_delta, :must_be_within_delta # :nodoc:
|
49
50
|
|
50
51
|
##
|
51
52
|
# See Minitest::Assertions#assert_in_epsilon
|
52
53
|
#
|
53
|
-
# n.must_be_within_epsilon m [, epsilon]
|
54
|
+
# _(n).must_be_within_epsilon m [, epsilon]
|
54
55
|
#
|
55
56
|
# :method: must_be_within_epsilon
|
56
57
|
|
@@ -59,7 +60,7 @@ module Minitest::Expectations
|
|
59
60
|
##
|
60
61
|
# See Minitest::Assertions#assert_includes
|
61
62
|
#
|
62
|
-
# collection.must_include obj
|
63
|
+
# _(collection).must_include obj
|
63
64
|
#
|
64
65
|
# :method: must_include
|
65
66
|
|
@@ -68,7 +69,7 @@ module Minitest::Expectations
|
|
68
69
|
##
|
69
70
|
# See Minitest::Assertions#assert_instance_of
|
70
71
|
#
|
71
|
-
# obj.must_be_instance_of klass
|
72
|
+
# _(obj).must_be_instance_of klass
|
72
73
|
#
|
73
74
|
# :method: must_be_instance_of
|
74
75
|
|
@@ -77,7 +78,7 @@ module Minitest::Expectations
|
|
77
78
|
##
|
78
79
|
# See Minitest::Assertions#assert_kind_of
|
79
80
|
#
|
80
|
-
# obj.must_be_kind_of mod
|
81
|
+
# _(obj).must_be_kind_of mod
|
81
82
|
#
|
82
83
|
# :method: must_be_kind_of
|
83
84
|
|
@@ -86,7 +87,7 @@ module Minitest::Expectations
|
|
86
87
|
##
|
87
88
|
# See Minitest::Assertions#assert_match
|
88
89
|
#
|
89
|
-
# a.must_match b
|
90
|
+
# _(a).must_match b
|
90
91
|
#
|
91
92
|
# :method: must_match
|
92
93
|
|
@@ -95,7 +96,7 @@ module Minitest::Expectations
|
|
95
96
|
##
|
96
97
|
# See Minitest::Assertions#assert_nil
|
97
98
|
#
|
98
|
-
# obj.must_be_nil
|
99
|
+
# _(obj).must_be_nil
|
99
100
|
#
|
100
101
|
# :method: must_be_nil
|
101
102
|
|
@@ -104,11 +105,11 @@ module Minitest::Expectations
|
|
104
105
|
##
|
105
106
|
# See Minitest::Assertions#assert_operator
|
106
107
|
#
|
107
|
-
# n.must_be :<=, 42
|
108
|
+
# _(n).must_be :<=, 42
|
108
109
|
#
|
109
110
|
# This can also do predicates:
|
110
111
|
#
|
111
|
-
# str.must_be :empty?
|
112
|
+
# _(str).must_be :empty?
|
112
113
|
#
|
113
114
|
# :method: must_be
|
114
115
|
|
@@ -117,7 +118,7 @@ module Minitest::Expectations
|
|
117
118
|
##
|
118
119
|
# See Minitest::Assertions#assert_output
|
119
120
|
#
|
120
|
-
#
|
121
|
+
# _ { ... }.must_output out_or_nil [, err]
|
121
122
|
#
|
122
123
|
# :method: must_output
|
123
124
|
|
@@ -126,7 +127,7 @@ module Minitest::Expectations
|
|
126
127
|
##
|
127
128
|
# See Minitest::Assertions#assert_raises
|
128
129
|
#
|
129
|
-
#
|
130
|
+
# _ { ... }.must_raise exception
|
130
131
|
#
|
131
132
|
# :method: must_raise
|
132
133
|
|
@@ -135,7 +136,7 @@ module Minitest::Expectations
|
|
135
136
|
##
|
136
137
|
# See Minitest::Assertions#assert_respond_to
|
137
138
|
#
|
138
|
-
# obj.must_respond_to msg
|
139
|
+
# _(obj).must_respond_to msg
|
139
140
|
#
|
140
141
|
# :method: must_respond_to
|
141
142
|
|
@@ -144,7 +145,7 @@ module Minitest::Expectations
|
|
144
145
|
##
|
145
146
|
# See Minitest::Assertions#assert_same
|
146
147
|
#
|
147
|
-
# a.must_be_same_as b
|
148
|
+
# _(a).must_be_same_as b
|
148
149
|
#
|
149
150
|
# :method: must_be_same_as
|
150
151
|
|
@@ -153,7 +154,7 @@ module Minitest::Expectations
|
|
153
154
|
##
|
154
155
|
# See Minitest::Assertions#assert_silent
|
155
156
|
#
|
156
|
-
#
|
157
|
+
# _ { ... }.must_be_silent
|
157
158
|
#
|
158
159
|
# :method: must_be_silent
|
159
160
|
|
@@ -162,16 +163,34 @@ module Minitest::Expectations
|
|
162
163
|
##
|
163
164
|
# See Minitest::Assertions#assert_throws
|
164
165
|
#
|
165
|
-
#
|
166
|
+
# _ { ... }.must_throw sym
|
166
167
|
#
|
167
168
|
# :method: must_throw
|
168
169
|
|
169
170
|
infect_an_assertion :assert_throws, :must_throw, :block
|
170
171
|
|
172
|
+
##
|
173
|
+
# See Minitest::Assertions#assert_path_exists
|
174
|
+
#
|
175
|
+
# _(some_path).path_must_exist
|
176
|
+
#
|
177
|
+
# :method: path_must_exist
|
178
|
+
|
179
|
+
infect_an_assertion :assert_path_exists, :path_must_exist, :unary
|
180
|
+
|
181
|
+
##
|
182
|
+
# See Minitest::Assertions#refute_path_exists
|
183
|
+
#
|
184
|
+
# _(some_path).path_wont_exist
|
185
|
+
#
|
186
|
+
# :method: path_wont_exist
|
187
|
+
|
188
|
+
infect_an_assertion :refute_path_exists, :path_wont_exist, :unary
|
189
|
+
|
171
190
|
##
|
172
191
|
# See Minitest::Assertions#refute_empty
|
173
192
|
#
|
174
|
-
# collection.wont_be_empty
|
193
|
+
# _(collection).wont_be_empty
|
175
194
|
#
|
176
195
|
# :method: wont_be_empty
|
177
196
|
|
@@ -180,7 +199,7 @@ module Minitest::Expectations
|
|
180
199
|
##
|
181
200
|
# See Minitest::Assertions#refute_equal
|
182
201
|
#
|
183
|
-
# a.wont_equal b
|
202
|
+
# _(a).wont_equal b
|
184
203
|
#
|
185
204
|
# :method: wont_equal
|
186
205
|
|
@@ -189,18 +208,18 @@ module Minitest::Expectations
|
|
189
208
|
##
|
190
209
|
# See Minitest::Assertions#refute_in_delta
|
191
210
|
#
|
192
|
-
# n.wont_be_close_to m [, delta]
|
211
|
+
# _(n).wont_be_close_to m [, delta]
|
193
212
|
#
|
194
213
|
# :method: wont_be_close_to
|
195
214
|
|
196
215
|
infect_an_assertion :refute_in_delta, :wont_be_close_to
|
197
216
|
|
198
|
-
|
217
|
+
infect_an_assertion :refute_in_delta, :wont_be_within_delta # :nodoc:
|
199
218
|
|
200
219
|
##
|
201
220
|
# See Minitest::Assertions#refute_in_epsilon
|
202
221
|
#
|
203
|
-
# n.wont_be_within_epsilon m [, epsilon]
|
222
|
+
# _(n).wont_be_within_epsilon m [, epsilon]
|
204
223
|
#
|
205
224
|
# :method: wont_be_within_epsilon
|
206
225
|
|
@@ -209,7 +228,7 @@ module Minitest::Expectations
|
|
209
228
|
##
|
210
229
|
# See Minitest::Assertions#refute_includes
|
211
230
|
#
|
212
|
-
# collection.wont_include obj
|
231
|
+
# _(collection).wont_include obj
|
213
232
|
#
|
214
233
|
# :method: wont_include
|
215
234
|
|
@@ -218,7 +237,7 @@ module Minitest::Expectations
|
|
218
237
|
##
|
219
238
|
# See Minitest::Assertions#refute_instance_of
|
220
239
|
#
|
221
|
-
# obj.wont_be_instance_of klass
|
240
|
+
# _(obj).wont_be_instance_of klass
|
222
241
|
#
|
223
242
|
# :method: wont_be_instance_of
|
224
243
|
|
@@ -227,7 +246,7 @@ module Minitest::Expectations
|
|
227
246
|
##
|
228
247
|
# See Minitest::Assertions#refute_kind_of
|
229
248
|
#
|
230
|
-
# obj.wont_be_kind_of mod
|
249
|
+
# _(obj).wont_be_kind_of mod
|
231
250
|
#
|
232
251
|
# :method: wont_be_kind_of
|
233
252
|
|
@@ -236,7 +255,7 @@ module Minitest::Expectations
|
|
236
255
|
##
|
237
256
|
# See Minitest::Assertions#refute_match
|
238
257
|
#
|
239
|
-
# a.wont_match b
|
258
|
+
# _(a).wont_match b
|
240
259
|
#
|
241
260
|
# :method: wont_match
|
242
261
|
|
@@ -245,7 +264,7 @@ module Minitest::Expectations
|
|
245
264
|
##
|
246
265
|
# See Minitest::Assertions#refute_nil
|
247
266
|
#
|
248
|
-
# obj.wont_be_nil
|
267
|
+
# _(obj).wont_be_nil
|
249
268
|
#
|
250
269
|
# :method: wont_be_nil
|
251
270
|
|
@@ -254,7 +273,7 @@ module Minitest::Expectations
|
|
254
273
|
##
|
255
274
|
# See Minitest::Assertions#refute_operator
|
256
275
|
#
|
257
|
-
# n.wont_be :<=, 42
|
276
|
+
# _(n).wont_be :<=, 42
|
258
277
|
#
|
259
278
|
# This can also do predicates:
|
260
279
|
#
|
@@ -267,7 +286,7 @@ module Minitest::Expectations
|
|
267
286
|
##
|
268
287
|
# See Minitest::Assertions#refute_respond_to
|
269
288
|
#
|
270
|
-
# obj.wont_respond_to msg
|
289
|
+
# _(obj).wont_respond_to msg
|
271
290
|
#
|
272
291
|
# :method: wont_respond_to
|
273
292
|
|
@@ -276,7 +295,7 @@ module Minitest::Expectations
|
|
276
295
|
##
|
277
296
|
# See Minitest::Assertions#refute_same
|
278
297
|
#
|
279
|
-
# a.wont_be_same_as b
|
298
|
+
# _(a).wont_be_same_as b
|
280
299
|
#
|
281
300
|
# :method: wont_be_same_as
|
282
301
|
|