minitest 5.14.0 → 5.14.2
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +20 -3
- data/Rakefile +4 -2
- 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 +17 -9
- data/test/minitest/test_minitest_spec.rb +56 -36
- data/test/minitest/test_minitest_test.rb +7 -3
- metadata +9 -6
- 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: 463f6b37e39c4fb39d08330f5a8fdf88fc942796b5df85858681920918dc42d3
|
4
|
+
data.tar.gz: 4c3c32504fa31bba4ac7399d878fb1f36961f3647f5cae849f0bbdafa0dacc26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d0bee9dacb54b6c9d04b2ab5d9bc497907af2c468443e4a12aaf7b44fd13aa417c06c9ff9076b76590994e67a722bac7f45ef954c08d0a57c2ce21a19c8c70e
|
7
|
+
data.tar.gz: ffc6922ff0a89ab7bbecac705df59b7a285c2d475085ec59e6767cd7f61a14795b9cee253490112932865971c464c4f1a2e7195523a3bba426d434aa06aa3838
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
=== 5.14.2 / 2020-08-31
|
2
|
+
|
3
|
+
* 1 bug fix:
|
4
|
+
|
5
|
+
* Bumped ruby version to include 3.0 (trunk).
|
6
|
+
|
7
|
+
=== 5.14.1 / 2020-05-15
|
8
|
+
|
9
|
+
* 3 minor enhancements:
|
10
|
+
|
11
|
+
* Minitest.filter_backtrace returns original backtrace if filter comes back empty.
|
12
|
+
* Minitest::BacktraceFilter now returns entire backtrace if $MT_DEBUG set in env.
|
13
|
+
* Return true on a successful refute. (jusleg)
|
14
|
+
|
15
|
+
* 1 bug fix:
|
16
|
+
|
17
|
+
* Fixed expectation doco to not use global expectations.
|
18
|
+
|
1
19
|
=== 5.14.0 / 2020-01-11
|
2
20
|
|
3
21
|
* 2 minor enhancements:
|
@@ -193,7 +211,7 @@
|
|
193
211
|
* 2 bug fixes:
|
194
212
|
|
195
213
|
* Re-release to refresh gem certificate signing. ugh.
|
196
|
-
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
214
|
+
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
197
215
|
|
198
216
|
=== 5.9.0 / 2016-05-16
|
199
217
|
|
@@ -217,7 +235,7 @@
|
|
217
235
|
* 2 bug fixes:
|
218
236
|
|
219
237
|
* Re-release to refresh gem certificate signing. ugh.
|
220
|
-
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
238
|
+
* Fixed hoe/minitest to not augment load path if we're actually testing minitest.
|
221
239
|
|
222
240
|
=== 5.8.4 / 2016-01-21
|
223
241
|
|
@@ -1377,4 +1395,3 @@ back.
|
|
1377
1395
|
* 1 major enhancement
|
1378
1396
|
|
1379
1397
|
* Birthday!
|
1380
|
-
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ Hoe.spec "minitest" do
|
|
11
11
|
|
12
12
|
license "MIT"
|
13
13
|
|
14
|
-
require_ruby_version "
|
14
|
+
require_ruby_version [">= 2.2", "< 3.1"]
|
15
15
|
end
|
16
16
|
|
17
17
|
desc "Find missing expectations"
|
@@ -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.2" # :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
|
|
@@ -1118,16 +1118,20 @@ class TestMinitestAssertions < Minitest::Test
|
|
1118
1118
|
end
|
1119
1119
|
end
|
1120
1120
|
|
1121
|
+
def assert_fail_after t
|
1122
|
+
@tc.fail_after t.year, t.month, t.day, "remove the deprecations"
|
1123
|
+
end
|
1124
|
+
|
1121
1125
|
def test_fail_after
|
1122
|
-
|
1123
|
-
|
1126
|
+
d0 = Time.now
|
1127
|
+
d1 = d0 + 86_400 # I am an idiot
|
1124
1128
|
|
1125
1129
|
assert_silent do
|
1126
|
-
|
1130
|
+
assert_fail_after d1
|
1127
1131
|
end
|
1128
1132
|
|
1129
1133
|
assert_triggered "remove the deprecations" do
|
1130
|
-
|
1134
|
+
assert_fail_after d0
|
1131
1135
|
end
|
1132
1136
|
end
|
1133
1137
|
|
@@ -1150,7 +1154,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
1150
1154
|
def test_refute
|
1151
1155
|
@assertion_count = 2
|
1152
1156
|
|
1153
|
-
@tc.assert_equal
|
1157
|
+
@tc.assert_equal true, @tc.refute(false), "returns true on success"
|
1154
1158
|
end
|
1155
1159
|
|
1156
1160
|
def test_refute_empty
|
@@ -1342,18 +1346,22 @@ class TestMinitestAssertions < Minitest::Test
|
|
1342
1346
|
end
|
1343
1347
|
end
|
1344
1348
|
|
1349
|
+
def assert_skip_until t, msg
|
1350
|
+
@tc.skip_until t.year, t.month, t.day, msg
|
1351
|
+
end
|
1352
|
+
|
1345
1353
|
def test_skip_until
|
1346
1354
|
@assertion_count = 0
|
1347
1355
|
|
1348
|
-
|
1349
|
-
|
1356
|
+
d0 = Time.now
|
1357
|
+
d1 = d0 + 86_400 # I am an idiot
|
1350
1358
|
|
1351
1359
|
assert_output "", /Stale skip_until \"not yet\" at .*?:\d+$/ do
|
1352
|
-
|
1360
|
+
assert_skip_until d0, "not yet"
|
1353
1361
|
end
|
1354
1362
|
|
1355
1363
|
assert_triggered "not ready yet", Minitest::Skip do
|
1356
|
-
|
1364
|
+
assert_skip_until d1, "not ready yet"
|
1357
1365
|
end
|
1358
1366
|
end
|
1359
1367
|
|
@@ -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.2
|
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-01
|
32
|
+
date: 2020-09-01 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.
|
@@ -169,16 +169,19 @@ require_paths:
|
|
169
169
|
- lib
|
170
170
|
required_ruby_version: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
|
-
- - "
|
172
|
+
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '2.2'
|
175
|
+
- - "<"
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '3.1'
|
175
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
179
|
requirements:
|
177
180
|
- - ">="
|
178
181
|
- !ruby/object:Gem::Version
|
179
182
|
version: '0'
|
180
183
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
184
|
+
rubygems_version: 3.1.4
|
182
185
|
signing_key:
|
183
186
|
specification_version: 4
|
184
187
|
summary: minitest provides a complete suite of testing facilities supporting TDD,
|
metadata.gz.sig
CHANGED
Binary file
|