minitest 5.14.0 → 5.14.1
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.tar.gz.sig +0 -0
- data/History.rdoc +12 -0
- data/Rakefile +3 -1
- data/lib/minitest.rb +7 -4
- data/lib/minitest/assertions.rb +1 -1
- data/lib/minitest/expectations.rb +29 -29
- data/test/minitest/metametameta.rb +19 -0
- data/test/minitest/test_minitest_assertions.rb +1 -1
- data/test/minitest/test_minitest_spec.rb +56 -36
- data/test/minitest/test_minitest_test.rb +7 -3
- metadata +4 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ed38adcad085c6c7c1cb81e9b580908d0b5b1b3696ad0014485b6524c20e344
|
4
|
+
data.tar.gz: c3574e199c963262186d5c865f248570194b1614ab4fcba13e5dfa8a2419785c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 543a116cf39777334557ecae8d76768afcb860995555945295669a68c20c9268543112368f65c848081ff0ab2ca727a87590676c3cadf1bc87bebc5986f08e92
|
7
|
+
data.tar.gz: b23ea10b6259ad60c96dbd3a384e8d39dcac48d3f961a26b3aa6e910ed947e6fc2d4b36fb06e8e84667457a6d897e3dca855771c0c6c3bfb81b38d3d83c1b3af
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 5.14.1 / 2020-05-15
|
2
|
+
|
3
|
+
* 3 minor enhancements:
|
4
|
+
|
5
|
+
* Minitest.filter_backtrace returns original backtrace if filter comes back empty.
|
6
|
+
* Minitest::BacktraceFilter now returns entire backtrace if $MT_DEBUG set in env.
|
7
|
+
* Return true on a successful refute. (jusleg)
|
8
|
+
|
9
|
+
* 1 bug fix:
|
10
|
+
|
11
|
+
* Fixed expectation doco to not use global expectations.
|
12
|
+
|
1
13
|
=== 5.14.0 / 2020-01-11
|
2
14
|
|
3
15
|
* 2 minor enhancements:
|
data/Rakefile
CHANGED
@@ -21,7 +21,7 @@ task :specs do
|
|
21
21
|
require "minitest/spec"
|
22
22
|
|
23
23
|
pos_prefix, neg_prefix = "must", "wont"
|
24
|
-
skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|raise$)/x
|
24
|
+
skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|send|raise$)/x
|
25
25
|
dont_flip_re = /(must|wont)_(include|respond_to)/
|
26
26
|
|
27
27
|
map = {
|
@@ -32,6 +32,8 @@ task :specs do
|
|
32
32
|
/_includes/ => "_include",
|
33
33
|
/(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
|
34
34
|
/must_raises/ => "must_raise",
|
35
|
+
/(must|wont)_predicate/ => '\1_be',
|
36
|
+
/(must|wont)_path_exists/ => 'path_\1_exist',
|
35
37
|
}
|
36
38
|
|
37
39
|
expectations = Minitest::Expectations.public_instance_methods.map(&:to_s)
|
data/lib/minitest.rb
CHANGED
@@ -8,7 +8,7 @@ require "stringio"
|
|
8
8
|
# :include: README.rdoc
|
9
9
|
|
10
10
|
module Minitest
|
11
|
-
VERSION = "5.14.
|
11
|
+
VERSION = "5.14.1" # :nodoc:
|
12
12
|
ENCS = "".respond_to? :encoding # :nodoc:
|
13
13
|
|
14
14
|
@@installed_at_exit ||= false
|
@@ -238,7 +238,9 @@ module Minitest
|
|
238
238
|
end
|
239
239
|
|
240
240
|
def self.filter_backtrace bt # :nodoc:
|
241
|
-
backtrace_filter.filter bt
|
241
|
+
result = backtrace_filter.filter bt
|
242
|
+
result = bt.dup if result.empty?
|
243
|
+
result
|
242
244
|
end
|
243
245
|
|
244
246
|
##
|
@@ -1005,12 +1007,13 @@ module Minitest
|
|
1005
1007
|
MT_RE = %r%lib/minitest% #:nodoc:
|
1006
1008
|
|
1007
1009
|
##
|
1008
|
-
# Filter +bt+ to something useful. Returns the whole thing if
|
1010
|
+
# Filter +bt+ to something useful. Returns the whole thing if
|
1011
|
+
# $DEBUG (ruby) or $MT_DEBUG (env).
|
1009
1012
|
|
1010
1013
|
def filter bt
|
1011
1014
|
return ["No backtrace"] unless bt
|
1012
1015
|
|
1013
|
-
return bt.dup if $DEBUG
|
1016
|
+
return bt.dup if $DEBUG || ENV["MT_DEBUG"]
|
1014
1017
|
|
1015
1018
|
new_bt = bt.take_while { |line| line !~ MT_RE }
|
1016
1019
|
new_bt = bt.select { |line| line !~ MT_RE } if new_bt.empty?
|
data/lib/minitest/assertions.rb
CHANGED
@@ -22,7 +22,7 @@ module Minitest::Expectations
|
|
22
22
|
##
|
23
23
|
# See Minitest::Assertions#assert_empty.
|
24
24
|
#
|
25
|
-
# collection.must_be_empty
|
25
|
+
# _(collection).must_be_empty
|
26
26
|
#
|
27
27
|
# :method: must_be_empty
|
28
28
|
|
@@ -31,7 +31,7 @@ module Minitest::Expectations
|
|
31
31
|
##
|
32
32
|
# See Minitest::Assertions#assert_equal
|
33
33
|
#
|
34
|
-
# a.must_equal b
|
34
|
+
# _(a).must_equal b
|
35
35
|
#
|
36
36
|
# :method: must_equal
|
37
37
|
|
@@ -40,7 +40,7 @@ module Minitest::Expectations
|
|
40
40
|
##
|
41
41
|
# See Minitest::Assertions#assert_in_delta
|
42
42
|
#
|
43
|
-
# n.must_be_close_to m [, delta]
|
43
|
+
# _(n).must_be_close_to m [, delta]
|
44
44
|
#
|
45
45
|
# :method: must_be_close_to
|
46
46
|
|
@@ -51,7 +51,7 @@ module Minitest::Expectations
|
|
51
51
|
##
|
52
52
|
# See Minitest::Assertions#assert_in_epsilon
|
53
53
|
#
|
54
|
-
# n.must_be_within_epsilon m [, epsilon]
|
54
|
+
# _(n).must_be_within_epsilon m [, epsilon]
|
55
55
|
#
|
56
56
|
# :method: must_be_within_epsilon
|
57
57
|
|
@@ -60,7 +60,7 @@ module Minitest::Expectations
|
|
60
60
|
##
|
61
61
|
# See Minitest::Assertions#assert_includes
|
62
62
|
#
|
63
|
-
# collection.must_include obj
|
63
|
+
# _(collection).must_include obj
|
64
64
|
#
|
65
65
|
# :method: must_include
|
66
66
|
|
@@ -69,7 +69,7 @@ module Minitest::Expectations
|
|
69
69
|
##
|
70
70
|
# See Minitest::Assertions#assert_instance_of
|
71
71
|
#
|
72
|
-
# obj.must_be_instance_of klass
|
72
|
+
# _(obj).must_be_instance_of klass
|
73
73
|
#
|
74
74
|
# :method: must_be_instance_of
|
75
75
|
|
@@ -78,7 +78,7 @@ module Minitest::Expectations
|
|
78
78
|
##
|
79
79
|
# See Minitest::Assertions#assert_kind_of
|
80
80
|
#
|
81
|
-
# obj.must_be_kind_of mod
|
81
|
+
# _(obj).must_be_kind_of mod
|
82
82
|
#
|
83
83
|
# :method: must_be_kind_of
|
84
84
|
|
@@ -87,7 +87,7 @@ module Minitest::Expectations
|
|
87
87
|
##
|
88
88
|
# See Minitest::Assertions#assert_match
|
89
89
|
#
|
90
|
-
# a.must_match b
|
90
|
+
# _(a).must_match b
|
91
91
|
#
|
92
92
|
# :method: must_match
|
93
93
|
|
@@ -96,7 +96,7 @@ module Minitest::Expectations
|
|
96
96
|
##
|
97
97
|
# See Minitest::Assertions#assert_nil
|
98
98
|
#
|
99
|
-
# obj.must_be_nil
|
99
|
+
# _(obj).must_be_nil
|
100
100
|
#
|
101
101
|
# :method: must_be_nil
|
102
102
|
|
@@ -105,11 +105,11 @@ module Minitest::Expectations
|
|
105
105
|
##
|
106
106
|
# See Minitest::Assertions#assert_operator
|
107
107
|
#
|
108
|
-
# n.must_be :<=, 42
|
108
|
+
# _(n).must_be :<=, 42
|
109
109
|
#
|
110
110
|
# This can also do predicates:
|
111
111
|
#
|
112
|
-
# str.must_be :empty?
|
112
|
+
# _(str).must_be :empty?
|
113
113
|
#
|
114
114
|
# :method: must_be
|
115
115
|
|
@@ -118,7 +118,7 @@ module Minitest::Expectations
|
|
118
118
|
##
|
119
119
|
# See Minitest::Assertions#assert_output
|
120
120
|
#
|
121
|
-
#
|
121
|
+
# _ { ... }.must_output out_or_nil [, err]
|
122
122
|
#
|
123
123
|
# :method: must_output
|
124
124
|
|
@@ -127,7 +127,7 @@ module Minitest::Expectations
|
|
127
127
|
##
|
128
128
|
# See Minitest::Assertions#assert_raises
|
129
129
|
#
|
130
|
-
#
|
130
|
+
# _ { ... }.must_raise exception
|
131
131
|
#
|
132
132
|
# :method: must_raise
|
133
133
|
|
@@ -136,7 +136,7 @@ module Minitest::Expectations
|
|
136
136
|
##
|
137
137
|
# See Minitest::Assertions#assert_respond_to
|
138
138
|
#
|
139
|
-
# obj.must_respond_to msg
|
139
|
+
# _(obj).must_respond_to msg
|
140
140
|
#
|
141
141
|
# :method: must_respond_to
|
142
142
|
|
@@ -145,7 +145,7 @@ module Minitest::Expectations
|
|
145
145
|
##
|
146
146
|
# See Minitest::Assertions#assert_same
|
147
147
|
#
|
148
|
-
# a.must_be_same_as b
|
148
|
+
# _(a).must_be_same_as b
|
149
149
|
#
|
150
150
|
# :method: must_be_same_as
|
151
151
|
|
@@ -154,7 +154,7 @@ module Minitest::Expectations
|
|
154
154
|
##
|
155
155
|
# See Minitest::Assertions#assert_silent
|
156
156
|
#
|
157
|
-
#
|
157
|
+
# _ { ... }.must_be_silent
|
158
158
|
#
|
159
159
|
# :method: must_be_silent
|
160
160
|
|
@@ -163,7 +163,7 @@ module Minitest::Expectations
|
|
163
163
|
##
|
164
164
|
# See Minitest::Assertions#assert_throws
|
165
165
|
#
|
166
|
-
#
|
166
|
+
# _ { ... }.must_throw sym
|
167
167
|
#
|
168
168
|
# :method: must_throw
|
169
169
|
|
@@ -190,7 +190,7 @@ module Minitest::Expectations
|
|
190
190
|
##
|
191
191
|
# See Minitest::Assertions#refute_empty
|
192
192
|
#
|
193
|
-
# collection.wont_be_empty
|
193
|
+
# _(collection).wont_be_empty
|
194
194
|
#
|
195
195
|
# :method: wont_be_empty
|
196
196
|
|
@@ -199,7 +199,7 @@ module Minitest::Expectations
|
|
199
199
|
##
|
200
200
|
# See Minitest::Assertions#refute_equal
|
201
201
|
#
|
202
|
-
# a.wont_equal b
|
202
|
+
# _(a).wont_equal b
|
203
203
|
#
|
204
204
|
# :method: wont_equal
|
205
205
|
|
@@ -208,7 +208,7 @@ module Minitest::Expectations
|
|
208
208
|
##
|
209
209
|
# See Minitest::Assertions#refute_in_delta
|
210
210
|
#
|
211
|
-
# n.wont_be_close_to m [, delta]
|
211
|
+
# _(n).wont_be_close_to m [, delta]
|
212
212
|
#
|
213
213
|
# :method: wont_be_close_to
|
214
214
|
|
@@ -219,7 +219,7 @@ module Minitest::Expectations
|
|
219
219
|
##
|
220
220
|
# See Minitest::Assertions#refute_in_epsilon
|
221
221
|
#
|
222
|
-
# n.wont_be_within_epsilon m [, epsilon]
|
222
|
+
# _(n).wont_be_within_epsilon m [, epsilon]
|
223
223
|
#
|
224
224
|
# :method: wont_be_within_epsilon
|
225
225
|
|
@@ -228,7 +228,7 @@ module Minitest::Expectations
|
|
228
228
|
##
|
229
229
|
# See Minitest::Assertions#refute_includes
|
230
230
|
#
|
231
|
-
# collection.wont_include obj
|
231
|
+
# _(collection).wont_include obj
|
232
232
|
#
|
233
233
|
# :method: wont_include
|
234
234
|
|
@@ -237,7 +237,7 @@ module Minitest::Expectations
|
|
237
237
|
##
|
238
238
|
# See Minitest::Assertions#refute_instance_of
|
239
239
|
#
|
240
|
-
# obj.wont_be_instance_of klass
|
240
|
+
# _(obj).wont_be_instance_of klass
|
241
241
|
#
|
242
242
|
# :method: wont_be_instance_of
|
243
243
|
|
@@ -246,7 +246,7 @@ module Minitest::Expectations
|
|
246
246
|
##
|
247
247
|
# See Minitest::Assertions#refute_kind_of
|
248
248
|
#
|
249
|
-
# obj.wont_be_kind_of mod
|
249
|
+
# _(obj).wont_be_kind_of mod
|
250
250
|
#
|
251
251
|
# :method: wont_be_kind_of
|
252
252
|
|
@@ -255,7 +255,7 @@ module Minitest::Expectations
|
|
255
255
|
##
|
256
256
|
# See Minitest::Assertions#refute_match
|
257
257
|
#
|
258
|
-
# a.wont_match b
|
258
|
+
# _(a).wont_match b
|
259
259
|
#
|
260
260
|
# :method: wont_match
|
261
261
|
|
@@ -264,7 +264,7 @@ module Minitest::Expectations
|
|
264
264
|
##
|
265
265
|
# See Minitest::Assertions#refute_nil
|
266
266
|
#
|
267
|
-
# obj.wont_be_nil
|
267
|
+
# _(obj).wont_be_nil
|
268
268
|
#
|
269
269
|
# :method: wont_be_nil
|
270
270
|
|
@@ -273,7 +273,7 @@ module Minitest::Expectations
|
|
273
273
|
##
|
274
274
|
# See Minitest::Assertions#refute_operator
|
275
275
|
#
|
276
|
-
# n.wont_be :<=, 42
|
276
|
+
# _(n).wont_be :<=, 42
|
277
277
|
#
|
278
278
|
# This can also do predicates:
|
279
279
|
#
|
@@ -286,7 +286,7 @@ module Minitest::Expectations
|
|
286
286
|
##
|
287
287
|
# See Minitest::Assertions#refute_respond_to
|
288
288
|
#
|
289
|
-
# obj.wont_respond_to msg
|
289
|
+
# _(obj).wont_respond_to msg
|
290
290
|
#
|
291
291
|
# :method: wont_respond_to
|
292
292
|
|
@@ -295,7 +295,7 @@ module Minitest::Expectations
|
|
295
295
|
##
|
296
296
|
# See Minitest::Assertions#refute_same
|
297
297
|
#
|
298
|
-
# a.wont_be_same_as b
|
298
|
+
# _(a).wont_be_same_as b
|
299
299
|
#
|
300
300
|
# :method: wont_be_same_as
|
301
301
|
|
@@ -6,8 +6,27 @@ class Minitest::Test
|
|
6
6
|
def clean s
|
7
7
|
s.gsub(/^ {6}/, "")
|
8
8
|
end
|
9
|
+
|
10
|
+
def with_empty_backtrace_filter
|
11
|
+
original = Minitest.backtrace_filter
|
12
|
+
|
13
|
+
obj = Minitest::BacktraceFilter.new
|
14
|
+
def obj.filter _bt
|
15
|
+
[]
|
16
|
+
end
|
17
|
+
|
18
|
+
Minitest::Test.io_lock.synchronize do # try not to trounce in parallel
|
19
|
+
begin
|
20
|
+
Minitest.backtrace_filter = obj
|
21
|
+
yield
|
22
|
+
ensure
|
23
|
+
Minitest.backtrace_filter = original
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
9
27
|
end
|
10
28
|
|
29
|
+
|
11
30
|
class FakeNamedTest < Minitest::Test
|
12
31
|
@@count = 0
|
13
32
|
|
@@ -1150,7 +1150,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
1150
1150
|
def test_refute
|
1151
1151
|
@assertion_count = 2
|
1152
1152
|
|
1153
|
-
@tc.assert_equal
|
1153
|
+
@tc.assert_equal true, @tc.refute(false), "returns true on success"
|
1154
1154
|
end
|
1155
1155
|
|
1156
1156
|
def test_refute_empty
|
@@ -43,6 +43,10 @@ describe Minitest::Spec do
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def assert_success spec
|
47
|
+
assert_equal true, spec
|
48
|
+
end
|
49
|
+
|
46
50
|
before do
|
47
51
|
@assertion_count = 4
|
48
52
|
end
|
@@ -62,7 +66,7 @@ describe Minitest::Spec do
|
|
62
66
|
it "needs to check for file existence" do
|
63
67
|
@assertion_count = 3
|
64
68
|
|
65
|
-
_(
|
69
|
+
assert_success _(__FILE__).path_must_exist
|
66
70
|
|
67
71
|
assert_triggered "Expected path 'blah' to exist." do
|
68
72
|
_("blah").path_must_exist
|
@@ -72,7 +76,7 @@ describe Minitest::Spec do
|
|
72
76
|
it "needs to check for file non-existence" do
|
73
77
|
@assertion_count = 3
|
74
78
|
|
75
|
-
_(
|
79
|
+
assert_success _("blah").path_wont_exist
|
76
80
|
|
77
81
|
assert_triggered "Expected path '#{__FILE__}' to not exist." do
|
78
82
|
_(__FILE__).path_wont_exist
|
@@ -82,7 +86,7 @@ describe Minitest::Spec do
|
|
82
86
|
it "needs to be sensible about must_include order" do
|
83
87
|
@assertion_count += 3 # must_include is 2 assertions
|
84
88
|
|
85
|
-
_(
|
89
|
+
assert_success _([1, 2, 3]).must_include(2)
|
86
90
|
|
87
91
|
assert_triggered "Expected [1, 2, 3] to include 5." do
|
88
92
|
_([1, 2, 3]).must_include 5
|
@@ -96,7 +100,7 @@ describe Minitest::Spec do
|
|
96
100
|
it "needs to be sensible about wont_include order" do
|
97
101
|
@assertion_count += 3 # wont_include is 2 assertions
|
98
102
|
|
99
|
-
_(
|
103
|
+
assert_success _([1, 2, 3]).wont_include(5)
|
100
104
|
|
101
105
|
assert_triggered "Expected [1, 2, 3] to not include 2." do
|
102
106
|
_([1, 2, 3]).wont_include 2
|
@@ -137,7 +141,7 @@ describe Minitest::Spec do
|
|
137
141
|
@assertion_count -= 1 # no msg
|
138
142
|
@assertion_count += 2 # assert_output is 2 assertions
|
139
143
|
|
140
|
-
|
144
|
+
assert_success expect {}.must_be_silent
|
141
145
|
|
142
146
|
assert_triggered "In stdout.\nExpected: \"\"\n Actual: \"xxx\"" do
|
143
147
|
expect { print "xxx" }.must_be_silent
|
@@ -195,7 +199,7 @@ describe Minitest::Spec do
|
|
195
199
|
end
|
196
200
|
|
197
201
|
it "needs to verify binary messages" do
|
198
|
-
_(
|
202
|
+
assert_success _(42).wont_be(:<, 24)
|
199
203
|
|
200
204
|
assert_triggered "Expected 24 to not be < 42." do
|
201
205
|
_(24).wont_be :<, 42
|
@@ -209,7 +213,7 @@ describe Minitest::Spec do
|
|
209
213
|
it "needs to verify emptyness" do
|
210
214
|
@assertion_count += 3 # empty is 2 assertions
|
211
215
|
|
212
|
-
_(
|
216
|
+
assert_success _([]).must_be_empty
|
213
217
|
|
214
218
|
assert_triggered "Expected [42] to be empty." do
|
215
219
|
_([42]).must_be_empty
|
@@ -223,7 +227,7 @@ describe Minitest::Spec do
|
|
223
227
|
it "needs to verify equality" do
|
224
228
|
@assertion_count += 1
|
225
229
|
|
226
|
-
_(
|
230
|
+
assert_success _(6 * 7).must_equal(42)
|
227
231
|
|
228
232
|
assert_triggered "Expected: 42\n Actual: 54" do
|
229
233
|
_(6 * 9).must_equal 42
|
@@ -242,7 +246,7 @@ describe Minitest::Spec do
|
|
242
246
|
@assertion_count += 1 # extra test
|
243
247
|
|
244
248
|
out, err = capture_io do
|
245
|
-
_(
|
249
|
+
assert_success _(nil).must_equal(nil)
|
246
250
|
end
|
247
251
|
|
248
252
|
exp = "DEPRECATED: Use assert_nil if expecting nil from #{__FILE__}:#{__LINE__-3}. " \
|
@@ -256,7 +260,7 @@ describe Minitest::Spec do
|
|
256
260
|
it "needs to verify floats outside a delta" do
|
257
261
|
@assertion_count += 1 # extra test
|
258
262
|
|
259
|
-
_(
|
263
|
+
assert_success _(24).wont_be_close_to(42)
|
260
264
|
|
261
265
|
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= 0.001." do
|
262
266
|
_(6 * 7.0).wont_be_close_to 42
|
@@ -275,7 +279,7 @@ describe Minitest::Spec do
|
|
275
279
|
it "needs to verify floats outside an epsilon" do
|
276
280
|
@assertion_count += 1 # extra test
|
277
281
|
|
278
|
-
_(
|
282
|
+
assert_success _(24).wont_be_within_epsilon(42)
|
279
283
|
|
280
284
|
x = "0.042"
|
281
285
|
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
|
@@ -295,7 +299,7 @@ describe Minitest::Spec do
|
|
295
299
|
it "needs to verify floats within a delta" do
|
296
300
|
@assertion_count += 1 # extra test
|
297
301
|
|
298
|
-
_(
|
302
|
+
assert_success _(6.0 * 7).must_be_close_to(42.0)
|
299
303
|
|
300
304
|
assert_triggered "Expected |0.0 - 0.01| (0.01) to be <= 0.001." do
|
301
305
|
_(1.0 / 100).must_be_close_to 0.0
|
@@ -314,7 +318,7 @@ describe Minitest::Spec do
|
|
314
318
|
it "needs to verify floats within an epsilon" do
|
315
319
|
@assertion_count += 1 # extra test
|
316
320
|
|
317
|
-
_(
|
321
|
+
assert_success _(6.0 * 7).must_be_within_epsilon(42.0)
|
318
322
|
|
319
323
|
assert_triggered "Expected |0.0 - 0.01| (0.01) to be <= 0.0." do
|
320
324
|
_(1.0 / 100).must_be_within_epsilon 0.0
|
@@ -330,7 +334,7 @@ describe Minitest::Spec do
|
|
330
334
|
end
|
331
335
|
|
332
336
|
it "needs to verify identity" do
|
333
|
-
_(
|
337
|
+
assert_success _(1).must_be_same_as(1)
|
334
338
|
|
335
339
|
assert_triggered "Expected 1 (oid=N) to be the same as 2 (oid=N)." do
|
336
340
|
_(1).must_be_same_as 2
|
@@ -343,8 +347,8 @@ describe Minitest::Spec do
|
|
343
347
|
|
344
348
|
it "needs to verify inequality" do
|
345
349
|
@assertion_count += 2
|
346
|
-
_(
|
347
|
-
_(
|
350
|
+
assert_success _(42).wont_equal(6 * 9)
|
351
|
+
assert_success _(proc {}).wont_equal(42)
|
348
352
|
|
349
353
|
assert_triggered "Expected 1 to not be equal to 1." do
|
350
354
|
_(1).wont_equal 1
|
@@ -356,7 +360,7 @@ describe Minitest::Spec do
|
|
356
360
|
end
|
357
361
|
|
358
362
|
it "needs to verify instances of a class" do
|
359
|
-
_(
|
363
|
+
assert_success _(42).wont_be_instance_of(String)
|
360
364
|
|
361
365
|
assert_triggered "Expected 42 to not be a kind of #{Int.name}." do
|
362
366
|
_(42).wont_be_kind_of Int
|
@@ -370,8 +374,8 @@ describe Minitest::Spec do
|
|
370
374
|
it "needs to verify kinds of a class" do
|
371
375
|
@assertion_count += 2
|
372
376
|
|
373
|
-
_(
|
374
|
-
_(
|
377
|
+
assert_success _(42).wont_be_kind_of(String)
|
378
|
+
assert_success _(proc {}).wont_be_kind_of(String)
|
375
379
|
|
376
380
|
assert_triggered "Expected 42 to not be a kind of #{Int.name}." do
|
377
381
|
_(42).wont_be_kind_of Int
|
@@ -385,8 +389,8 @@ describe Minitest::Spec do
|
|
385
389
|
it "needs to verify kinds of objects" do
|
386
390
|
@assertion_count += 3 # extra test
|
387
391
|
|
388
|
-
_(
|
389
|
-
_(
|
392
|
+
assert_success _(6 * 7).must_be_kind_of(Int)
|
393
|
+
assert_success _(6 * 7).must_be_kind_of(Numeric)
|
390
394
|
|
391
395
|
assert_triggered "Expected 42 to be a kind of String, not #{Int.name}." do
|
392
396
|
_(6 * 7).must_be_kind_of String
|
@@ -405,7 +409,7 @@ describe Minitest::Spec do
|
|
405
409
|
it "needs to verify mismatch" do
|
406
410
|
@assertion_count += 3 # match is 2
|
407
411
|
|
408
|
-
_(
|
412
|
+
assert_success _("blah").wont_match(/\d+/)
|
409
413
|
|
410
414
|
assert_triggered "Expected /\\w+/ to not match \"blah\"." do
|
411
415
|
_("blah").wont_match(/\w+/)
|
@@ -417,7 +421,7 @@ describe Minitest::Spec do
|
|
417
421
|
end
|
418
422
|
|
419
423
|
it "needs to verify nil" do
|
420
|
-
_(
|
424
|
+
assert_success _(nil).must_be_nil
|
421
425
|
|
422
426
|
assert_triggered "Expected 42 to be nil." do
|
423
427
|
_(42).must_be_nil
|
@@ -431,7 +435,7 @@ describe Minitest::Spec do
|
|
431
435
|
it "needs to verify non-emptyness" do
|
432
436
|
@assertion_count += 3 # empty is 2 assertions
|
433
437
|
|
434
|
-
_(
|
438
|
+
assert_success _(["some item"]).wont_be_empty
|
435
439
|
|
436
440
|
assert_triggered "Expected [] to not be empty." do
|
437
441
|
_([]).wont_be_empty
|
@@ -443,7 +447,7 @@ describe Minitest::Spec do
|
|
443
447
|
end
|
444
448
|
|
445
449
|
it "needs to verify non-identity" do
|
446
|
-
_(
|
450
|
+
assert_success _(1).wont_be_same_as(2)
|
447
451
|
|
448
452
|
assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do
|
449
453
|
_(1).wont_be_same_as 1
|
@@ -455,7 +459,7 @@ describe Minitest::Spec do
|
|
455
459
|
end
|
456
460
|
|
457
461
|
it "needs to verify non-nil" do
|
458
|
-
_(
|
462
|
+
assert_success _(42).wont_be_nil
|
459
463
|
|
460
464
|
assert_triggered "Expected nil to not be nil." do
|
461
465
|
_(nil).wont_be_nil
|
@@ -467,7 +471,7 @@ describe Minitest::Spec do
|
|
467
471
|
end
|
468
472
|
|
469
473
|
it "needs to verify objects not responding to a message" do
|
470
|
-
_(
|
474
|
+
assert_success _("").wont_respond_to(:woot!)
|
471
475
|
|
472
476
|
assert_triggered "Expected \"\" to not respond to to_s." do
|
473
477
|
_("").wont_respond_to :to_s
|
@@ -481,7 +485,7 @@ describe Minitest::Spec do
|
|
481
485
|
it "needs to verify output in stderr" do
|
482
486
|
@assertion_count -= 1 # no msg
|
483
487
|
|
484
|
-
|
488
|
+
assert_success expect { $stderr.print "blah" }.must_output(nil, "blah")
|
485
489
|
|
486
490
|
assert_triggered "In stderr.\nExpected: \"blah\"\n Actual: \"xxx\"" do
|
487
491
|
expect { $stderr.print "xxx" }.must_output(nil, "blah")
|
@@ -491,7 +495,7 @@ describe Minitest::Spec do
|
|
491
495
|
it "needs to verify output in stdout" do
|
492
496
|
@assertion_count -= 1 # no msg
|
493
497
|
|
494
|
-
|
498
|
+
assert_success expect { print "blah" }.must_output("blah")
|
495
499
|
|
496
500
|
assert_triggered "In stdout.\nExpected: \"blah\"\n Actual: \"xxx\"" do
|
497
501
|
expect { print "xxx" }.must_output("blah")
|
@@ -501,7 +505,7 @@ describe Minitest::Spec do
|
|
501
505
|
it "needs to verify regexp matches" do
|
502
506
|
@assertion_count += 3 # must_match is 2 assertions
|
503
507
|
|
504
|
-
_(
|
508
|
+
assert_success _("blah").must_match(/\w+/)
|
505
509
|
|
506
510
|
assert_triggered "Expected /\\d+/ to match \"blah\"." do
|
507
511
|
_("blah").must_match(/\d+/)
|
@@ -567,12 +571,28 @@ describe Minitest::Spec do
|
|
567
571
|
(1 + 1).must_equal 2
|
568
572
|
end
|
569
573
|
end
|
574
|
+
|
575
|
+
# https://github.com/seattlerb/minitest/issues/837
|
576
|
+
# https://github.com/rails/rails/pull/39304
|
577
|
+
it "deprecates expectation used without _ with empty backtrace_filter" do
|
578
|
+
skip "N/A" if ENV["MT_NO_EXPECTATIONS"]
|
579
|
+
|
580
|
+
@assertion_count += 3
|
581
|
+
|
582
|
+
exp = /DEPRECATED: global use of must_equal from/
|
583
|
+
|
584
|
+
with_empty_backtrace_filter do
|
585
|
+
assert_output "", exp do
|
586
|
+
(1 + 1).must_equal 2
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|
570
590
|
end
|
571
591
|
|
572
592
|
it "needs to verify throw" do
|
573
593
|
@assertion_count += 2 # 2 extra tests
|
574
594
|
|
575
|
-
|
595
|
+
assert_success expect { throw :blah }.must_throw(:blah)
|
576
596
|
|
577
597
|
assert_triggered "Expected :blah to have been thrown." do
|
578
598
|
expect {}.must_throw :blah
|
@@ -592,7 +612,7 @@ describe Minitest::Spec do
|
|
592
612
|
end
|
593
613
|
|
594
614
|
it "needs to verify types of objects" do
|
595
|
-
_(
|
615
|
+
assert_success _(6 * 7).must_be_instance_of(Int)
|
596
616
|
|
597
617
|
exp = "Expected 42 to be an instance of String, not #{Int.name}."
|
598
618
|
|
@@ -608,7 +628,7 @@ describe Minitest::Spec do
|
|
608
628
|
it "needs to verify using any (negative) predicate" do
|
609
629
|
@assertion_count -= 1 # doesn"t take a message
|
610
630
|
|
611
|
-
_(
|
631
|
+
assert_success _("blah").wont_be(:empty?)
|
612
632
|
|
613
633
|
assert_triggered "Expected \"\" to not be empty?." do
|
614
634
|
_("").wont_be :empty?
|
@@ -618,7 +638,7 @@ describe Minitest::Spec do
|
|
618
638
|
it "needs to verify using any binary operator" do
|
619
639
|
@assertion_count -= 1 # no msg
|
620
640
|
|
621
|
-
_(
|
641
|
+
assert_success _(41).must_be(:<, 42)
|
622
642
|
|
623
643
|
assert_triggered "Expected 42 to be < 41." do
|
624
644
|
_(42).must_be(:<, 41)
|
@@ -628,7 +648,7 @@ describe Minitest::Spec do
|
|
628
648
|
it "needs to verify using any predicate" do
|
629
649
|
@assertion_count -= 1 # no msg
|
630
650
|
|
631
|
-
_(
|
651
|
+
assert_success _("").must_be(:empty?)
|
632
652
|
|
633
653
|
assert_triggered "Expected \"blah\" to be empty?." do
|
634
654
|
_("blah").must_be :empty?
|
@@ -636,7 +656,7 @@ describe Minitest::Spec do
|
|
636
656
|
end
|
637
657
|
|
638
658
|
it "needs to verify using respond_to" do
|
639
|
-
_(
|
659
|
+
assert_success _(42).must_respond_to(:+)
|
640
660
|
|
641
661
|
assert_triggered "Expected 42 (#{Int.name}) to respond to #clear." do
|
642
662
|
_(42).must_respond_to :clear
|
@@ -75,9 +75,13 @@ class TestMinitestUnit < MetaMetaMetaTestCase
|
|
75
75
|
assert_equal ex, fu
|
76
76
|
end
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
def test_filter_backtrace__empty
|
79
|
+
with_empty_backtrace_filter do
|
80
|
+
bt = %w[first second third]
|
81
|
+
fu = Minitest.filter_backtrace bt.dup
|
82
|
+
assert_equal bt, fu
|
83
|
+
end
|
84
|
+
end
|
81
85
|
|
82
86
|
def test_infectious_binary_encoding
|
83
87
|
@tu = Class.new FakeNamedTest do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.14.
|
4
|
+
version: 5.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
m5x9IDiApM+vCELNwDXXGNFEnQBBK+wAe4Pek8o1V1TTOxL1kGPewVOitX1p3xoN
|
30
30
|
h7iEjga8iM1LbZUfiISZ+WrB
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2020-
|
32
|
+
date: 2020-05-16 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '3.
|
60
|
+
version: '3.22'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: '3.
|
67
|
+
version: '3.22'
|
68
68
|
description: |-
|
69
69
|
minitest provides a complete suite of testing facilities supporting
|
70
70
|
TDD, BDD, mocking, and benchmarking.
|
metadata.gz.sig
CHANGED
Binary file
|