minitest 5.12.2 → 5.13.0
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 -0
- data/lib/minitest.rb +16 -1
- data/lib/minitest/assertions.rb +85 -17
- data/lib/minitest/expectations.rb +18 -0
- data/lib/minitest/spec.rb +15 -8
- data/test/minitest/metametameta.rb +20 -8
- data/test/minitest/test_minitest_assertions.rb +51 -3
- data/test/minitest/test_minitest_mock.rb +0 -2
- data/test/minitest/test_minitest_spec.rb +31 -11
- data/test/minitest/test_minitest_test.rb +35 -10
- metadata +2 -2
- metadata.gz.sig +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36b98534b771e1eb6b67bae4b151e957f74f7e2159b589c3527e5eb0762aaa94
|
4
|
+
data.tar.gz: c5e6fab215fc67cf3133867954b55d438b00d11c1fa2df17efe456fc2ea29fb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee628ae22e60b6457c8896b86e35cef293d2bd16277b9ed55ebb7b866a98c65087ca09416c214476c821a2147e40ad3ca0a7eeab9c6ce43f19e68807b5f1753e
|
7
|
+
data.tar.gz: 99c5476047e5418137429ea4d8a5ead8d6f2bca2fb5e316dcff656d083d318ee2b19b66ce2365ee639b6217ef1ad5c22fda103497953639aebb0c5876c8f0683
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
=== 5.13.0 / 2019-10-29
|
2
|
+
|
3
|
+
* 9 minor enhancements:
|
4
|
+
|
5
|
+
* Added Minitest::Guard#osx?
|
6
|
+
* Added examples to documentation for assert_raises. (lxxxvi)
|
7
|
+
* Added expectations #path_must_exist and #path_wont_exist. Not thrilled with the names.
|
8
|
+
* Added fail_after(year, month, day, msg) to allow time-bombing after a deadline.
|
9
|
+
* Added skip_until(year, month, day, msg) to allow deferring until a deadline.
|
10
|
+
* Deprecated Minitest::Guard#maglev?
|
11
|
+
* Deprecated Minitest::Guard#rubinius?
|
12
|
+
* Finally added assert_path_exists and refute_path_exists. (deivid-rodriguez)
|
13
|
+
* Refactored and pulled Assertions#things_to_diff out of #diff. (BurdetteLamar)
|
14
|
+
|
15
|
+
* 3 bug fixes:
|
16
|
+
|
17
|
+
* Fix autorun bug that affects fork exit status in tests. (dylanahsmith/jhawthorn)
|
18
|
+
* Improved documentation for _/value/expect, especially for blocks. (svoop)
|
19
|
+
* Support new Proc#to_s format. (ko1)
|
20
|
+
|
1
21
|
=== 5.12.2 / 2019-09-28
|
2
22
|
|
3
23
|
* 1 bug fix:
|
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.
|
11
|
+
VERSION = "5.13.0" # :nodoc:
|
12
12
|
ENCS = "".respond_to? :encoding # :nodoc:
|
13
13
|
|
14
14
|
@@installed_at_exit ||= false
|
@@ -58,7 +58,9 @@ module Minitest
|
|
58
58
|
|
59
59
|
exit_code = nil
|
60
60
|
|
61
|
+
pid = Process.pid
|
61
62
|
at_exit {
|
63
|
+
next if Process.pid != pid
|
62
64
|
@@after_run.reverse_each(&:call)
|
63
65
|
exit exit_code || false
|
64
66
|
}
|
@@ -958,6 +960,9 @@ module Minitest
|
|
958
960
|
# Is this running on maglev?
|
959
961
|
|
960
962
|
def maglev? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
|
963
|
+
where = Minitest.filter_backtrace(caller).first
|
964
|
+
where = where.split(/:in /, 2).first # clean up noise
|
965
|
+
warn "DEPRECATED: `maglev?` called from #{where}. This will fail in Minitest 6."
|
961
966
|
"maglev" == platform
|
962
967
|
end
|
963
968
|
|
@@ -968,10 +973,20 @@ module Minitest
|
|
968
973
|
/^ruby/ =~ platform
|
969
974
|
end
|
970
975
|
|
976
|
+
##
|
977
|
+
# Is this running on macOS?
|
978
|
+
|
979
|
+
def osx? platform = RUBY_PLATFORM
|
980
|
+
/darwin/ =~ platform
|
981
|
+
end
|
982
|
+
|
971
983
|
##
|
972
984
|
# Is this running on rubinius?
|
973
985
|
|
974
986
|
def rubinius? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
|
987
|
+
where = Minitest.filter_backtrace(caller).first
|
988
|
+
where = where.split(/:in /, 2).first # clean up noise
|
989
|
+
warn "DEPRECATED: `rubinius?` called from #{where}. This will fail in Minitest 6."
|
975
990
|
"rbx" == platform
|
976
991
|
end
|
977
992
|
|
data/lib/minitest/assertions.rb
CHANGED
@@ -32,8 +32,6 @@ module Minitest
|
|
32
32
|
@diff = if (RbConfig::CONFIG["host_os"] =~ /mswin|mingw/ &&
|
33
33
|
system("diff.exe", __FILE__, __FILE__)) then
|
34
34
|
"diff.exe -u"
|
35
|
-
elsif Minitest::Test.maglev? then
|
36
|
-
"diff -u"
|
37
35
|
elsif system("gdiff", __FILE__, __FILE__)
|
38
36
|
"gdiff -u" # solaris and kin suck
|
39
37
|
elsif system("diff", __FILE__, __FILE__)
|
@@ -55,25 +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
|
-
b1, b2 = butwas.include?("\n"), butwas.include?("\\n")
|
66
|
-
|
67
|
-
need_to_diff =
|
68
|
-
(e1 ^ e2 ||
|
69
|
-
b1 ^ b2 ||
|
70
|
-
expect.size > 30 ||
|
71
|
-
butwas.size > 30 ||
|
72
|
-
expect == butwas) &&
|
73
|
-
Minitest::Assertions.diff
|
62
|
+
expect, butwas = things_to_diff(exp, act)
|
74
63
|
|
75
64
|
return "Expected: #{mu_pp exp}\n Actual: #{mu_pp act}" unless
|
76
|
-
|
65
|
+
expect
|
77
66
|
|
78
67
|
Tempfile.open("expect") do |a|
|
79
68
|
a.puts expect
|
@@ -102,6 +91,34 @@ module Minitest
|
|
102
91
|
result
|
103
92
|
end
|
104
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
|
+
|
105
122
|
##
|
106
123
|
# This returns a human-readable version of +obj+. By default
|
107
124
|
# #inspect is called. You can override this to use #pretty_inspect
|
@@ -326,6 +343,14 @@ module Minitest
|
|
326
343
|
(!stdout || x) && (!stderr || y)
|
327
344
|
end
|
328
345
|
|
346
|
+
##
|
347
|
+
# Fails unless +path+ exists.
|
348
|
+
|
349
|
+
def assert_path_exists path, msg = nil
|
350
|
+
msg = message(msg) { "Expected path '#{path}' to exist" }
|
351
|
+
assert File.exist?(path), msg
|
352
|
+
end
|
353
|
+
|
329
354
|
##
|
330
355
|
# For testing with predicates. Eg:
|
331
356
|
#
|
@@ -346,7 +371,21 @@ module Minitest
|
|
346
371
|
#
|
347
372
|
# +exp+ takes an optional message on the end to help explain
|
348
373
|
# failures and defaults to StandardError if no exception class is
|
349
|
-
# passed.
|
374
|
+
# passed. Eg:
|
375
|
+
#
|
376
|
+
# assert_raises(CustomError) { method_with_custom_error }
|
377
|
+
#
|
378
|
+
# With custom error message:
|
379
|
+
#
|
380
|
+
# assert_raises(CustomError, 'This should have raised CustomError') { method_with_custom_error }
|
381
|
+
#
|
382
|
+
# Using the returned object:
|
383
|
+
#
|
384
|
+
# error = assert_raises(CustomError) do
|
385
|
+
# raise CustomError, 'This is really bad'
|
386
|
+
# end
|
387
|
+
#
|
388
|
+
# assert_equal 'This is really bad', error.message
|
350
389
|
|
351
390
|
def assert_raises *exp
|
352
391
|
flunk "assert_raises requires a block to capture errors." unless
|
@@ -537,7 +576,16 @@ module Minitest
|
|
537
576
|
end
|
538
577
|
|
539
578
|
##
|
540
|
-
# Fails
|
579
|
+
# Fails after a given date (in the local time zone). This allows
|
580
|
+
# you to put time-bombs in your tests if you need to keep
|
581
|
+
# something around until a later date lest you forget about it.
|
582
|
+
|
583
|
+
def fail_after y,m,d,msg
|
584
|
+
flunk msg if Time.now > Time.local(y, m, d)
|
585
|
+
end
|
586
|
+
|
587
|
+
##
|
588
|
+
# Fails with +msg+.
|
541
589
|
|
542
590
|
def flunk msg = nil
|
543
591
|
msg ||= "Epic Fail!"
|
@@ -671,6 +719,14 @@ module Minitest
|
|
671
719
|
refute o1.__send__(op, o2), msg
|
672
720
|
end
|
673
721
|
|
722
|
+
##
|
723
|
+
# Fails if +path+ exists.
|
724
|
+
|
725
|
+
def refute_path_exists path, msg = nil
|
726
|
+
msg = message(msg) { "Expected path '#{path}' to not exist" }
|
727
|
+
refute File.exist?(path), msg
|
728
|
+
end
|
729
|
+
|
674
730
|
##
|
675
731
|
# For testing with predicates.
|
676
732
|
#
|
@@ -716,6 +772,18 @@ module Minitest
|
|
716
772
|
raise Minitest::Skip, msg, bt
|
717
773
|
end
|
718
774
|
|
775
|
+
##
|
776
|
+
# Skips the current run until a given date (in the local time
|
777
|
+
# zone). This allows you to put some fixes on hold until a later
|
778
|
+
# date, but still holds you accountable and prevents you from
|
779
|
+
# forgetting it.
|
780
|
+
|
781
|
+
def skip_until y,m,d,msg
|
782
|
+
skip msg if Time.now < Time.local(y, m, d)
|
783
|
+
where = caller.first.split(/:/, 3).first(2).join ":"
|
784
|
+
warn "Stale skip_until %p at %s" % [msg, where]
|
785
|
+
end
|
786
|
+
|
719
787
|
##
|
720
788
|
# Was this testcase skipped? Meant for #teardown.
|
721
789
|
|
@@ -168,6 +168,24 @@ module Minitest::Expectations
|
|
168
168
|
|
169
169
|
infect_an_assertion :assert_throws, :must_throw, :block
|
170
170
|
|
171
|
+
##
|
172
|
+
# See Minitest::Assertions#assert_path_exists
|
173
|
+
#
|
174
|
+
# _(some_path).path_must_exist
|
175
|
+
#
|
176
|
+
# :method: path_must_exist
|
177
|
+
|
178
|
+
infect_an_assertion :assert_path_exists, :path_must_exist, :unary
|
179
|
+
|
180
|
+
##
|
181
|
+
# See Minitest::Assertions#refute_path_exists
|
182
|
+
#
|
183
|
+
# _(some_path).path_wont_exist
|
184
|
+
#
|
185
|
+
# :method: path_wont_exist
|
186
|
+
|
187
|
+
infect_an_assertion :refute_path_exists, :path_wont_exist, :unary
|
188
|
+
|
171
189
|
##
|
172
190
|
# See Minitest::Assertions#refute_empty
|
173
191
|
#
|
data/lib/minitest/spec.rb
CHANGED
@@ -289,21 +289,28 @@ class Minitest::Spec < Minitest::Test
|
|
289
289
|
|
290
290
|
module InstanceMethods
|
291
291
|
##
|
292
|
-
#
|
293
|
-
# available to it.
|
292
|
+
# Takes a value or a block and returns a value monad that has
|
293
|
+
# all of Expectations methods available to it.
|
294
294
|
#
|
295
|
-
#
|
295
|
+
# _(1 + 1).must_equal 2
|
296
296
|
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
297
|
+
# And for blocks:
|
298
|
+
#
|
299
|
+
# _ { 1 + "1" }.must_raise TypeError
|
300
300
|
#
|
301
301
|
# This method of expectation-based testing is preferable to
|
302
302
|
# straight-expectation methods (on Object) because it stores its
|
303
303
|
# test context, bypassing our hacky use of thread-local variables.
|
304
304
|
#
|
305
|
-
# At some point, the methods on Object will be deprecated
|
306
|
-
# removed.
|
305
|
+
# NOTE: At some point, the methods on Object will be deprecated
|
306
|
+
# and then removed.
|
307
|
+
#
|
308
|
+
# It is also aliased to #value and #expect for your aesthetic
|
309
|
+
# pleasure:
|
310
|
+
#
|
311
|
+
# _(1 + 1).must_equal 2
|
312
|
+
# value(1 + 1).must_equal 2
|
313
|
+
# expect(1 + 1).must_equal 2
|
307
314
|
|
308
315
|
def _ value = nil, &block
|
309
316
|
Minitest::Expectation.new block || value, self
|
@@ -25,6 +25,14 @@ class AnError < StandardError; include MyModule; end
|
|
25
25
|
class MetaMetaMetaTestCase < Minitest::Test
|
26
26
|
attr_accessor :reporter, :output, :tu
|
27
27
|
|
28
|
+
def with_stderr err
|
29
|
+
old = $stderr
|
30
|
+
$stderr = err
|
31
|
+
yield
|
32
|
+
ensure
|
33
|
+
$stderr = old
|
34
|
+
end
|
35
|
+
|
28
36
|
def run_tu_with_fresh_reporter flags = %w[--seed 42]
|
29
37
|
options = Minitest.process_args flags
|
30
38
|
|
@@ -34,18 +42,20 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
34
42
|
reporter << Minitest::SummaryReporter.new(@output, options)
|
35
43
|
reporter << Minitest::ProgressReporter.new(@output, options)
|
36
44
|
|
37
|
-
|
45
|
+
with_stderr @output do
|
46
|
+
reporter.start
|
38
47
|
|
39
|
-
|
48
|
+
yield(reporter) if block_given?
|
40
49
|
|
41
|
-
|
42
|
-
|
43
|
-
|
50
|
+
@tus ||= [@tu]
|
51
|
+
@tus.each do |tu|
|
52
|
+
Minitest::Runnable.runnables.delete tu
|
44
53
|
|
45
|
-
|
46
|
-
|
54
|
+
tu.run reporter, options
|
55
|
+
end
|
47
56
|
|
48
|
-
|
57
|
+
reporter.report
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
def first_reporter
|
@@ -84,6 +94,8 @@ class MetaMetaMetaTestCase < Minitest::Test
|
|
84
94
|
output.gsub!(/^(\s+)[^:]+:\d+:in/, '\1FILE:LINE:in')
|
85
95
|
end
|
86
96
|
|
97
|
+
output.gsub!(/( at )[^:]+:\d+/, '\1[FILE:LINE]')
|
98
|
+
|
87
99
|
output
|
88
100
|
end
|
89
101
|
|
@@ -397,7 +397,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
397
397
|
end
|
398
398
|
|
399
399
|
def test_assert_in_delta_triggered
|
400
|
-
x =
|
400
|
+
x = "1.0e-06"
|
401
401
|
assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do
|
402
402
|
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
|
403
403
|
end
|
@@ -428,7 +428,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
428
428
|
|
429
429
|
def test_assert_in_epsilon_triggered_negative_case
|
430
430
|
x = (RUBY18 and not maglev?) ? "0.1" : "0.100000xxx"
|
431
|
-
y =
|
431
|
+
y = "0.1"
|
432
432
|
assert_triggered "Expected |-1.1 - -1| (#{x}) to be <= #{y}." do
|
433
433
|
@tc.assert_in_epsilon(-1.1, -1, 0.1)
|
434
434
|
end
|
@@ -906,6 +906,16 @@ class TestMinitestAssertions < Minitest::Test
|
|
906
906
|
end
|
907
907
|
end
|
908
908
|
|
909
|
+
def test_assert_path_exists
|
910
|
+
@tc.assert_path_exists __FILE__
|
911
|
+
end
|
912
|
+
|
913
|
+
def test_assert_path_exists_triggered
|
914
|
+
assert_triggered "Expected path 'blah' to exist." do
|
915
|
+
@tc.assert_path_exists "blah"
|
916
|
+
end
|
917
|
+
end
|
918
|
+
|
909
919
|
def test_capture_io
|
910
920
|
@assertion_count = 0
|
911
921
|
|
@@ -978,6 +988,19 @@ class TestMinitestAssertions < Minitest::Test
|
|
978
988
|
end
|
979
989
|
end
|
980
990
|
|
991
|
+
def test_fail_after
|
992
|
+
t = Time.now
|
993
|
+
y, m, d = t.year, t.month, t.day
|
994
|
+
|
995
|
+
assert_silent do
|
996
|
+
@tc.fail_after y, m, d+1, "remove the deprecations"
|
997
|
+
end
|
998
|
+
|
999
|
+
assert_triggered "remove the deprecations" do
|
1000
|
+
@tc.fail_after y, m, d, "remove the deprecations"
|
1001
|
+
end
|
1002
|
+
end
|
1003
|
+
|
981
1004
|
def test_flunk
|
982
1005
|
assert_triggered "Epic Fail!" do
|
983
1006
|
@tc.flunk
|
@@ -1029,7 +1052,7 @@ class TestMinitestAssertions < Minitest::Test
|
|
1029
1052
|
end
|
1030
1053
|
|
1031
1054
|
def test_refute_in_delta_triggered
|
1032
|
-
x =
|
1055
|
+
x = "0.1"
|
1033
1056
|
assert_triggered "Expected |0.0 - 0.001| (0.001) to not be <= #{x}." do
|
1034
1057
|
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
|
1035
1058
|
end
|
@@ -1171,6 +1194,16 @@ class TestMinitestAssertions < Minitest::Test
|
|
1171
1194
|
end
|
1172
1195
|
end
|
1173
1196
|
|
1197
|
+
def test_refute_path_exists
|
1198
|
+
@tc.refute_path_exists "blah"
|
1199
|
+
end
|
1200
|
+
|
1201
|
+
def test_refute_path_exists_triggered
|
1202
|
+
assert_triggered "Expected path '#{__FILE__}' to not exist." do
|
1203
|
+
@tc.refute_path_exists __FILE__
|
1204
|
+
end
|
1205
|
+
end
|
1206
|
+
|
1174
1207
|
def test_skip
|
1175
1208
|
@assertion_count = 0
|
1176
1209
|
|
@@ -1179,6 +1212,21 @@ class TestMinitestAssertions < Minitest::Test
|
|
1179
1212
|
end
|
1180
1213
|
end
|
1181
1214
|
|
1215
|
+
def test_skip_until
|
1216
|
+
@assertion_count = 0
|
1217
|
+
|
1218
|
+
t = Time.now
|
1219
|
+
y, m, d = t.year, t.month, t.day
|
1220
|
+
|
1221
|
+
assert_output "", /Stale skip_until \"not yet\" at .*?:\d+$/ do
|
1222
|
+
@tc.skip_until y, m, d, "not yet"
|
1223
|
+
end
|
1224
|
+
|
1225
|
+
assert_triggered "not ready yet", Minitest::Skip do
|
1226
|
+
@tc.skip_until y, m, d+1, "not ready yet"
|
1227
|
+
end
|
1228
|
+
end
|
1229
|
+
|
1182
1230
|
def util_msg exp, act, msg = nil
|
1183
1231
|
s = "Expected: #{exp.inspect}\n Actual: #{act.inspect}"
|
1184
1232
|
s = "#{msg}.\n#{s}" if msg
|
@@ -26,9 +26,8 @@ describe Minitest::Spec do
|
|
26
26
|
|
27
27
|
msg = e.message.sub(/(---Backtrace---).*/m, '\1')
|
28
28
|
msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")
|
29
|
-
msg.gsub!(/@.+>/, "@PATH>")
|
30
29
|
msg.gsub!(/(\d\.\d{6})\d+/, '\1xxx') # normalize: ruby version, impl, platform
|
31
|
-
msg.gsub!(/:0x[
|
30
|
+
msg.gsub!(/:0x[Xa-fA-F0-9]{4,}[ @].+?>/, ":0xXXXXXX@PATH>")
|
32
31
|
|
33
32
|
if expected
|
34
33
|
@assertion_count += 1
|
@@ -60,6 +59,26 @@ describe Minitest::Spec do
|
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
62
|
+
it "needs to check for file existence" do
|
63
|
+
@assertion_count = 3
|
64
|
+
|
65
|
+
_(_(__FILE__).path_must_exist).must_equal true
|
66
|
+
|
67
|
+
assert_triggered "Expected path 'blah' to exist." do
|
68
|
+
_("blah").path_must_exist
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it "needs to check for file non-existence" do
|
73
|
+
@assertion_count = 3
|
74
|
+
|
75
|
+
_(_("blah").path_wont_exist).must_equal false
|
76
|
+
|
77
|
+
assert_triggered "Expected path '#{__FILE__}' to not exist." do
|
78
|
+
_(__FILE__).path_wont_exist
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
63
82
|
it "needs to be sensible about must_include order" do
|
64
83
|
@assertion_count += 3 # must_include is 2 assertions
|
65
84
|
|
@@ -130,10 +149,10 @@ describe Minitest::Spec do
|
|
130
149
|
|
131
150
|
@assertion_count = 2
|
132
151
|
|
133
|
-
methods =
|
152
|
+
methods = Minitest::Expectations.public_instance_methods.grep(/must|wont/)
|
134
153
|
methods.map!(&:to_s) if Symbol === methods.first
|
135
154
|
|
136
|
-
musts, wonts = methods.sort.partition { |m| m =~
|
155
|
+
musts, wonts = methods.sort.partition { |m| m =~ /must/ }
|
137
156
|
|
138
157
|
expected_musts = %w[must_be
|
139
158
|
must_be_close_to
|
@@ -151,11 +170,12 @@ describe Minitest::Spec do
|
|
151
170
|
must_output
|
152
171
|
must_raise
|
153
172
|
must_respond_to
|
154
|
-
must_throw
|
173
|
+
must_throw
|
174
|
+
path_must_exist]
|
155
175
|
|
156
176
|
bad = %w[not raise throw send output be_silent]
|
157
177
|
|
158
|
-
expected_wonts = expected_musts.map { |m| m.sub(
|
178
|
+
expected_wonts = expected_musts.map { |m| m.sub(/must/, "wont") }.sort
|
159
179
|
expected_wonts.reject! { |m| m =~ /wont_#{Regexp.union(*bad)}/ }
|
160
180
|
|
161
181
|
_(musts).must_equal expected_musts
|
@@ -213,7 +233,7 @@ describe Minitest::Spec do
|
|
213
233
|
_(6 * 9).must_equal 42, "msg"
|
214
234
|
end
|
215
235
|
|
216
|
-
assert_triggered(/^-42\n\+#<Proc:0xXXXXXX@PATH>\n/) do
|
236
|
+
assert_triggered(/^-42\n\+#<Proc:0xXXXXXX[ @]PATH>\n/) do
|
217
237
|
_(proc { 42 }).must_equal 42 # proc isn't called, so expectation fails
|
218
238
|
end
|
219
239
|
end
|
@@ -242,7 +262,7 @@ describe Minitest::Spec do
|
|
242
262
|
_(6 * 7.0).wont_be_close_to 42
|
243
263
|
end
|
244
264
|
|
245
|
-
x =
|
265
|
+
x = "1.0e-05"
|
246
266
|
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
|
247
267
|
_(6 * 7.0).wont_be_close_to 42, 0.00001
|
248
268
|
end
|
@@ -257,12 +277,12 @@ describe Minitest::Spec do
|
|
257
277
|
|
258
278
|
_(_(24).wont_be_within_epsilon(42)).must_equal false
|
259
279
|
|
260
|
-
x =
|
280
|
+
x = "0.042"
|
261
281
|
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
|
262
282
|
_(6 * 7.0).wont_be_within_epsilon 42
|
263
283
|
end
|
264
284
|
|
265
|
-
x =
|
285
|
+
x = "0.00042"
|
266
286
|
assert_triggered "Expected |42 - 42.0| (0.0) to not be <= #{x}." do
|
267
287
|
_(6 * 7.0).wont_be_within_epsilon 42, 0.00001
|
268
288
|
end
|
@@ -281,7 +301,7 @@ describe Minitest::Spec do
|
|
281
301
|
_(1.0 / 100).must_be_close_to 0.0
|
282
302
|
end
|
283
303
|
|
284
|
-
x =
|
304
|
+
x = "1.0e-06"
|
285
305
|
assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do
|
286
306
|
_(1.0 / 1000).must_be_close_to 0.0, 0.000001
|
287
307
|
end
|
@@ -582,8 +582,6 @@ class TestMinitestRunner < MetaMetaMetaTestCase
|
|
582
582
|
end
|
583
583
|
|
584
584
|
def test_run_parallel
|
585
|
-
skip "I don't have ParallelEach debugged yet" if maglev?
|
586
|
-
|
587
585
|
test_count = 2
|
588
586
|
test_latch = Latch.new test_count
|
589
587
|
wait_latch = Latch.new test_count
|
@@ -857,12 +855,7 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
857
855
|
end
|
858
856
|
|
859
857
|
srand 42
|
860
|
-
expected =
|
861
|
-
when maglev? then
|
862
|
-
%w[test_test2 test_test3 test_test1]
|
863
|
-
else
|
864
|
-
%w[test_test2 test_test1 test_test3]
|
865
|
-
end
|
858
|
+
expected = %w[test_test2 test_test1 test_test3]
|
866
859
|
assert_equal expected, sample_test_case.runnable_methods
|
867
860
|
end
|
868
861
|
|
@@ -901,6 +894,20 @@ class TestMinitestUnitTestCase < Minitest::Test
|
|
901
894
|
shitty_test_case.i_suck_and_my_tests_are_order_dependent!
|
902
895
|
end
|
903
896
|
end
|
897
|
+
|
898
|
+
def test_autorun_does_not_affect_fork_success_status
|
899
|
+
@assertion_count = 0
|
900
|
+
skip "windows doesn't have skip" unless Process.respond_to?(:fork)
|
901
|
+
Process.waitpid(fork {})
|
902
|
+
assert_equal true, $?.success?
|
903
|
+
end
|
904
|
+
|
905
|
+
def test_autorun_does_not_affect_fork_exit_status
|
906
|
+
@assertion_count = 0
|
907
|
+
skip "windows doesn't have skip" unless Process.respond_to?(:fork)
|
908
|
+
Process.waitpid(fork { exit 42 })
|
909
|
+
assert_equal 42, $?.exitstatus
|
910
|
+
end
|
904
911
|
end
|
905
912
|
|
906
913
|
class TestMinitestGuard < Minitest::Test
|
@@ -917,8 +924,26 @@ class TestMinitestGuard < Minitest::Test
|
|
917
924
|
end
|
918
925
|
|
919
926
|
def test_rubinius_eh
|
920
|
-
|
921
|
-
|
927
|
+
assert_output "", /DEPRECATED/ do
|
928
|
+
assert self.class.rubinius? "rbx"
|
929
|
+
end
|
930
|
+
assert_output "", /DEPRECATED/ do
|
931
|
+
assert self.rubinius? "rbx"
|
932
|
+
end
|
933
|
+
end
|
934
|
+
|
935
|
+
def test_maglev_eh
|
936
|
+
assert_output "", /DEPRECATED/ do
|
937
|
+
assert self.class.maglev? "maglev"
|
938
|
+
end
|
939
|
+
assert_output "", /DEPRECATED/ do
|
940
|
+
assert self.maglev? "maglev"
|
941
|
+
end
|
942
|
+
end
|
943
|
+
|
944
|
+
def test_osx_eh
|
945
|
+
assert self.class.osx? "darwin"
|
946
|
+
assert self.osx? "darwin"
|
922
947
|
end
|
923
948
|
|
924
949
|
def test_windows_eh
|
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.
|
4
|
+
version: 5.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -29,7 +29,7 @@ cert_chain:
|
|
29
29
|
Em82dBUFsipwMLCYj39kcyHWAxyl6Ae1Cn9r/ItVBCxoeFdrHjfavnrIEoXUt4bU
|
30
30
|
UfBugfLD19bu3nvL+zTAGx/U
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2019-
|
32
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: rdoc
|
metadata.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
]C��6��{��a�&�)_�;J�ꙜV�����]_5&�`Q[�Y����a����`������cV[��qo?�h�y�nҸZ4wz-�:�Z0ܧ�-e}ǹ�3��.Z��p��]u�_=���*B��-yf�9�_�kqS�+��:Je�|�e拆̷�vXi��e�XV6�>������uI=,���64����לi6�<���kɾދ�,f��,�=7�7�3�3yN�Gu:I��_�������IW8�
|