Class: TestMinitestAssertions
- Inherits:
-
Minitest::Test
show all
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb
Defined Under Namespace
Classes: DummyTest
Constant Summary
collapse
- RUBY18 =
do not call parallelize_me! - teardown accesses @tc._assertions which is not threadsafe. Nearly every method in here is an assertion test so it isn’t worth splitting it out further.
!defined? Encoding
- RE_LEVELS =
/\(\d+ levels\) /
Minitest::Test::PASSTHROUGH_EXCEPTIONS, Minitest::Test::SETUP_METHODS, Minitest::Test::TEARDOWN_METHODS
Minitest::Assertions::E, Minitest::Assertions::UNDEFINED
Minitest::Runnable::SIGNALS
Instance Attribute Summary
#assertions, #failures, #time
Instance Method Summary
collapse
#capture_exceptions, #class_name, i_suck_and_my_tests_are_order_dependent!, make_my_diffs_pretty!, #neuter_exception, #new_exception, parallelize_me!, #run, runnable_methods, #sanitize_exception, test_order, #with_empty_backtrace_filter, #with_info_handler
#jruby?, #maglev?, #mri?, #osx?, #rubinius?, #windows?
#after_setup, #after_teardown, #before_setup, #before_teardown
#class_name, #error?, #location, #passed?, #result_code, #skipped?
#_synchronize, #assert, #assert_empty, #assert_equal, #assert_in_delta, #assert_in_epsilon, #assert_includes, #assert_instance_of, #assert_kind_of, #assert_match, #assert_mock, #assert_nil, #assert_operator, #assert_output, #assert_path_exists, #assert_predicate, #assert_raises, #assert_respond_to, #assert_same, #assert_send, #assert_silent, #assert_throws, #capture_io, #capture_subprocess_io, #diff, diff, diff=, #exception_details, #fail_after, #flunk, #message, #mu_pp, #mu_pp_for_diff, #pass, #refute, #refute_empty, #refute_equal, #refute_in_delta, #refute_in_epsilon, #refute_includes, #refute_instance_of, #refute_kind_of, #refute_match, #refute_nil, #refute_operator, #refute_path_exists, #refute_predicate, #refute_respond_to, #refute_same, #skip, #skip_until, #skipped?, #things_to_diff
#failure, inherited, #initialize, #marshal_dump, #marshal_load, methods_matching, #name, #name=, on_signal, #passed?, reset, #result_code, run, #run, run_one_method, runnable_methods, runnables, #skipped?, #time_it, #whatever, with_info_handler
Instance Method Details
#assert_deprecated(name) ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 61
def assert_deprecated name
dep = /DEPRECATED: #{name}. From #{__FILE__}:\d+(?::.*)?/
dep = "" if $-w.nil?
assert_output nil, dep do
yield
end
end
|
#assert_fail_after(t) ⇒ Object
1137
1138
1139
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1137
def assert_fail_after t
@tc.fail_after t.year, t.month, t.day, "remove the deprecations"
end
|
#assert_skip_until(t, msg) ⇒ Object
1365
1366
1367
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1365
def assert_skip_until t, msg
@tc.skip_until t.year, t.month, t.day, msg
end
|
#assert_triggered(expected, klass = Minitest::Assertion) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 70
def assert_triggered expected, klass = Minitest::Assertion
e = assert_raises klass do
yield
end
msg = e.message.sub(/(---Backtrace---).*/m, '\1')
msg.gsub!(/\(oid=[-0-9]+\)/, "(oid=N)")
msg.gsub!(/(\d\.\d{6})\d+/, '\1xxx')
assert_msg = Regexp === expected ? :assert_match : :assert_equal
self.send assert_msg, expected, msg
end
|
#assert_unexpected(expected) ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 83
def assert_unexpected expected
expected = Regexp.new expected if String === expected
assert_triggered expected, Minitest::UnexpectedError do
yield
end
end
|
91
92
93
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 91
def clean s
s.gsub(/^ {6,10}/, "")
end
|
#non_verbose ⇒ Object
95
96
97
98
99
100
101
102
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 95
def non_verbose
orig_verbose = $VERBOSE
$VERBOSE = false
yield
ensure
$VERBOSE = orig_verbose
end
|
46
47
48
49
50
51
52
53
54
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 46
def setup
super
Minitest::Test.reset
@tc = DummyTest.new
@zomg = "zomg ponies!" @assertion_count = 1
end
|
56
57
58
59
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 56
def teardown
assert_equal(@assertion_count, @tc.assertions,
"expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}")
end
|
#test_assert ⇒ Object
104
105
106
107
108
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 104
def test_assert
@assertion_count = 2
@tc.assert_equal true, @tc.assert(true), "returns true on success"
end
|
#test_assert__triggered ⇒ Object
110
111
112
113
114
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 110
def test_assert__triggered
assert_triggered "Expected false to be truthy." do
@tc.assert false
end
end
|
#test_assert__triggered_lambda ⇒ Object
122
123
124
125
126
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 122
def test_assert__triggered_lambda
assert_triggered "whoops" do
@tc.assert false, lambda { "whoops" }
end
end
|
#test_assert__triggered_message ⇒ Object
116
117
118
119
120
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 116
def test_assert__triggered_message
assert_triggered @zomg do
@tc.assert false, @zomg
end
end
|
#test_assert_empty ⇒ Object
128
129
130
131
132
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 128
def test_assert_empty
@assertion_count = 2
@tc.assert_empty []
end
|
#test_assert_empty_triggered ⇒ Object
134
135
136
137
138
139
140
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 134
def test_assert_empty_triggered
@assertion_count = 2
assert_triggered "Expected [1] to be empty." do
@tc.assert_empty [1]
end
end
|
#test_assert_equal ⇒ Object
142
143
144
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 142
def test_assert_equal
@tc.assert_equal 1, 1
end
|
#test_assert_equal_different_collection_array_hex_invisible ⇒ Object
146
147
148
149
150
151
152
153
154
155
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 146
def test_assert_equal_different_collection_array_hex_invisible
object1 = Object.new
object2 = Object.new
msg = "No visible difference in the Array#inspect output.
You should look at the implementation of #== on Array or its members.
[#<Object:0xXXXXXX>]".gsub(/^ +/, "")
assert_triggered msg do
@tc.assert_equal [object1], [object2]
end
end
|
#test_assert_equal_different_collection_hash_hex_invisible ⇒ Object
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 157
def test_assert_equal_different_collection_hash_hex_invisible
h1, h2 = {}, {}
h1[1] = Object.new
h2[1] = Object.new
msg = "No visible difference in the Hash#inspect output.
You should look at the implementation of #== on Hash or its members.
{1=>#<Object:0xXXXXXX>}".gsub(/^ +/, "")
assert_triggered msg do
@tc.assert_equal h1, h2
end
end
|
#test_assert_equal_different_diff_deactivated ⇒ Object
170
171
172
173
174
175
176
177
178
179
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 170
def test_assert_equal_different_diff_deactivated
without_diff do
assert_triggered util_msg("haha" * 10, "blah" * 10) do
o1 = "haha" * 10
o2 = "blah" * 10
@tc.assert_equal o1, o2
end
end
end
|
#test_assert_equal_different_hex ⇒ Object
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 193
def test_assert_equal_different_hex
c = Class.new do
def initialize s; @name = s; end
end
o1 = c.new "a"
o2 = c.new "b"
msg = clean <<-EOS
--- expected
+++ actual
@@ -1 +1 @@
-#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"a\">
+#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"b\">
EOS
assert_triggered msg do
@tc.assert_equal o1, o2
end
end
|
#test_assert_equal_different_hex_invisible ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 213
def test_assert_equal_different_hex_invisible
o1 = Object.new
o2 = Object.new
msg = "No visible difference in the Object#inspect output.
You should look at the implementation of #== on Object or its members.
#<Object:0xXXXXXX>".gsub(/^ +/, "")
assert_triggered msg do
@tc.assert_equal o1, o2
end
end
|
#test_assert_equal_different_lambda ⇒ Object
187
188
189
190
191
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 187
def test_assert_equal_different_lambda
assert_triggered "whoops.\nExpected: 1\n Actual: 2" do
@tc.assert_equal 1, 2, lambda { "whoops" }
end
end
|
#test_assert_equal_different_long ⇒ Object
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 226
def test_assert_equal_different_long
msg = "--- expected
+++ actual
@@ -1 +1 @@
-\"hahahahahahahahahahahahahahahahahahahaha\"
+\"blahblahblahblahblahblahblahblahblahblah\"
".gsub(/^ +/, "")
assert_triggered msg do
o1 = "haha" * 10
o2 = "blah" * 10
@tc.assert_equal o1, o2
end
end
|
#test_assert_equal_different_long_invisible ⇒ Object
242
243
244
245
246
247
248
249
250
251
252
253
254
255
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 242
def test_assert_equal_different_long_invisible
msg = "No visible difference in the String#inspect output.
You should look at the implementation of #== on String or its members.
\"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
assert_triggered msg do
o1 = "blah" * 10
o2 = "blah" * 10
def o1.== _
false
end
@tc.assert_equal o1, o2
end
end
|
#test_assert_equal_different_long_msg ⇒ Object
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 257
def test_assert_equal_different_long_msg
msg = "message.
--- expected
+++ actual
@@ -1 +1 @@
-\"hahahahahahahahahahahahahahahahahahahaha\"
+\"blahblahblahblahblahblahblahblahblahblah\"
".gsub(/^ +/, "")
assert_triggered msg do
o1 = "haha" * 10
o2 = "blah" * 10
@tc.assert_equal o1, o2, "message"
end
end
|
#test_assert_equal_different_message ⇒ Object
181
182
183
184
185
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 181
def test_assert_equal_different_message
assert_triggered "whoops.\nExpected: 1\n Actual: 2" do
@tc.assert_equal 1, 2, message { "whoops" }
end
end
|
#test_assert_equal_different_short ⇒ Object
273
274
275
276
277
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 273
def test_assert_equal_different_short
assert_triggered util_msg(1, 2) do
@tc.assert_equal 1, 2
end
end
|
#test_assert_equal_different_short_msg ⇒ Object
279
280
281
282
283
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 279
def test_assert_equal_different_short_msg
assert_triggered util_msg(1, 2, "message") do
@tc.assert_equal 1, 2, "message"
end
end
|
#test_assert_equal_different_short_multiline ⇒ Object
285
286
287
288
289
290
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 285
def test_assert_equal_different_short_multiline
msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n"
assert_triggered msg do
@tc.assert_equal "a\nb", "a\nc"
end
end
|
#test_assert_equal_does_not_allow_lhs_nil ⇒ Object
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 292
def test_assert_equal_does_not_allow_lhs_nil
if Minitest::VERSION =~ /^6/ then
warn "Time to strip the MT5 test"
@assertion_count += 1
assert_triggered(/Use assert_nil if expecting nil/) do
@tc.assert_equal nil, nil
end
else
err_re = /Use assert_nil if expecting nil from .*test_minitest_\w+.rb/
err_re = "" if $-w.nil?
assert_output "", err_re do
@tc.assert_equal nil, nil
end
end
end
|
#test_assert_equal_does_not_allow_lhs_nil_triggered ⇒ Object
310
311
312
313
314
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 310
def test_assert_equal_does_not_allow_lhs_nil_triggered
assert_triggered "Expected: nil\n Actual: false" do
@tc.assert_equal nil, false
end
end
|
#test_assert_equal_string_both_escaped_unescaped_newlines ⇒ Object
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 332
def test_assert_equal_string_both_escaped_unescaped_newlines
msg = <<-EOM.gsub(/^ {10}/, "")
--- expected
+++ actual
@@ -1,2 +1 @@
-\"A\\n
-B\"
+\"A\\n\\\\nB\"
EOM
assert_triggered msg do
exp = "A\\nB"
act = "A\n\\nB"
@tc.assert_equal exp, act
end
end
|
#test_assert_equal_string_bug791 ⇒ Object
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 316
def test_assert_equal_string_bug791
exp = <<-'EOF'.gsub(/^ {10}/, "") --- expected
+++ actual
@@ -1,2 +1 @@
-"\\n
-"
+"\\\"
EOF
exp = "Expected: \"\\\\n\"\n Actual: \"\\\\\""
assert_triggered exp do
@tc.assert_equal "\\n", "\\"
end
end
|
#test_assert_equal_string_encodings ⇒ Object
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 350
def test_assert_equal_string_encodings
msg = <<-EOM.gsub(/^ {10}/, "")
--- expected
+++ actual
@@ -1,3 +1,3 @@
-# encoding: UTF-8
-# valid: false
+# encoding: #{Encoding::BINARY.name}
+# valid: true
"bad-utf8-\\xF1.txt"
EOM
assert_triggered msg do
x = "bad-utf8-\xF1.txt"
y = x.dup.force_encoding "binary" @tc.assert_equal x, y
end
end
|
#test_assert_equal_string_encodings_both_different ⇒ Object
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 369
def test_assert_equal_string_encodings_both_different
msg = <<-EOM.gsub(/^ {10}/, "")
--- expected
+++ actual
@@ -1,3 +1,3 @@
-# encoding: US-ASCII
-# valid: false
+# encoding: #{Encoding::BINARY.name}
+# valid: true
"bad-utf8-\\xF1.txt"
EOM
assert_triggered msg do
x = "bad-utf8-\xF1.txt".force_encoding "ASCII"
y = x.dup.force_encoding "binary" @tc.assert_equal x, y
end
end
|
#test_assert_equal_unescape_newlines ⇒ Object
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 388
def test_assert_equal_unescape_newlines
msg = <<-'EOM'.gsub(/^ {10}/, "") --- expected
+++ actual
@@ -1,2 +1,2 @@
-"hello
+"hello\n
world"
EOM
assert_triggered msg do
exp = "hello\nworld"
act = 'hello\nworld'
@tc.assert_equal exp, act
end
end
|
#test_assert_in_delta ⇒ Object
406
407
408
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 406
def test_assert_in_delta
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.1
end
|
#test_assert_in_delta_triggered ⇒ Object
410
411
412
413
414
415
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 410
def test_assert_in_delta_triggered
x = "1.0e-06"
assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
end
end
|
#test_assert_in_epsilon ⇒ Object
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 417
def test_assert_in_epsilon
@assertion_count = 10
@tc.assert_in_epsilon 10_000, 9991
@tc.assert_in_epsilon 9991, 10_000
@tc.assert_in_epsilon 1.0, 1.001
@tc.assert_in_epsilon 1.001, 1.0
@tc.assert_in_epsilon 10_000, 9999.1, 0.0001
@tc.assert_in_epsilon 9999.1, 10_000, 0.0001
@tc.assert_in_epsilon 1.0, 1.0001, 0.0001
@tc.assert_in_epsilon 1.0001, 1.0, 0.0001
@tc.assert_in_epsilon(-1, -1)
@tc.assert_in_epsilon(-10_000, -9991)
end
|
#test_assert_in_epsilon_triggered ⇒ Object
434
435
436
437
438
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 434
def test_assert_in_epsilon_triggered
assert_triggered "Expected |10000 - 9990| (10) to be <= 9.99." do
@tc.assert_in_epsilon 10_000, 9990
end
end
|
#test_assert_in_epsilon_triggered_negative_case ⇒ Object
440
441
442
443
444
445
446
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 440
def test_assert_in_epsilon_triggered_negative_case
x = (RUBY18 and not maglev?) ? "0.1" : "0.100000xxx"
y = "0.1"
assert_triggered "Expected |-1.1 - -1| (#{x}) to be <= #{y}." do
@tc.assert_in_epsilon(-1.1, -1, 0.1)
end
end
|
#test_assert_includes ⇒ Object
448
449
450
451
452
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 448
def test_assert_includes
@assertion_count = 2
@tc.assert_includes [true], true
end
|
#test_assert_includes_triggered ⇒ Object
454
455
456
457
458
459
460
461
462
463
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 454
def test_assert_includes_triggered
@assertion_count = 3
e = @tc.assert_raises Minitest::Assertion do
@tc.assert_includes [true], false
end
expected = "Expected [true] to include false."
assert_equal expected, e.message
end
|
#test_assert_instance_of ⇒ Object
465
466
467
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 465
def test_assert_instance_of
@tc.assert_instance_of String, "blah"
end
|
#test_assert_instance_of_triggered ⇒ Object
469
470
471
472
473
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 469
def test_assert_instance_of_triggered
assert_triggered 'Expected "blah" to be an instance of Array, not String.' do
@tc.assert_instance_of Array, "blah"
end
end
|
#test_assert_kind_of ⇒ Object
475
476
477
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 475
def test_assert_kind_of
@tc.assert_kind_of String, "blah"
end
|
#test_assert_kind_of_triggered ⇒ Object
479
480
481
482
483
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 479
def test_assert_kind_of_triggered
assert_triggered 'Expected "blah" to be a kind of Array, not String.' do
@tc.assert_kind_of Array, "blah"
end
end
|
#test_assert_match ⇒ Object
485
486
487
488
489
490
491
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 485
def test_assert_match
@assertion_count = 2
m = @tc.assert_match(/\w+/, "blah blah blah")
assert_kind_of MatchData, m
assert_equal "blah", m[0]
end
|
#test_assert_match_matchee_to_str ⇒ Object
493
494
495
496
497
498
499
500
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 493
def test_assert_match_matchee_to_str
@assertion_count = 2
obj = Object.new
def obj.to_str; "blah" end
@tc.assert_match "blah", obj
end
|
#test_assert_match_matcher_object ⇒ Object
502
503
504
505
506
507
508
509
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 502
def test_assert_match_matcher_object
@assertion_count = 2
pattern = Object.new
def pattern.=~ _; true end
@tc.assert_match pattern, 5
end
|
#test_assert_match_object_triggered ⇒ Object
511
512
513
514
515
516
517
518
519
520
521
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 511
def test_assert_match_object_triggered
@assertion_count = 2
pattern = Object.new
def pattern.=~ _; false end
def pattern.inspect; "[Object]" end
assert_triggered "Expected [Object] to match 5." do
@tc.assert_match pattern, 5
end
end
|
#test_assert_match_triggered ⇒ Object
523
524
525
526
527
528
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 523
def test_assert_match_triggered
@assertion_count = 2
assert_triggered 'Expected /\d+/ to match "blah blah blah".' do
@tc.assert_match(/\d+/, "blah blah blah")
end
end
|
#test_assert_nil ⇒ Object
530
531
532
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 530
def test_assert_nil
@tc.assert_nil nil
end
|
#test_assert_nil_triggered ⇒ Object
534
535
536
537
538
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 534
def test_assert_nil_triggered
assert_triggered "Expected 42 to be nil." do
@tc.assert_nil 42
end
end
|
#test_assert_operator ⇒ Object
540
541
542
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 540
def test_assert_operator
@tc.assert_operator 2, :>, 1
end
|
#test_assert_operator_bad_object ⇒ Object
544
545
546
547
548
549
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 544
def test_assert_operator_bad_object
bad = Object.new
def bad.== _; true end
@tc.assert_operator bad, :equal?, bad
end
|
#test_assert_operator_triggered ⇒ Object
551
552
553
554
555
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 551
def test_assert_operator_triggered
assert_triggered "Expected 2 to be < 1." do
@tc.assert_operator 2, :<, 1
end
end
|
#test_assert_output_both ⇒ Object
557
558
559
560
561
562
563
564
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 557
def test_assert_output_both
@assertion_count = 2
@tc.assert_output "yay", "blah" do
print "yay"
$stderr.print "blah"
end
end
|
#test_assert_output_both_regexps ⇒ Object
566
567
568
569
570
571
572
573
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 566
def test_assert_output_both_regexps
@assertion_count = 4
@tc.assert_output(/y.y/, /bl.h/) do
print "yay"
$stderr.print "blah"
end
end
|
#test_assert_output_err ⇒ Object
575
576
577
578
579
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 575
def test_assert_output_err
@tc.assert_output nil, "blah" do
$stderr.print "blah"
end
end
|
#test_assert_output_neither ⇒ Object
581
582
583
584
585
586
587
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 581
def test_assert_output_neither
@assertion_count = 0
@tc.assert_output do
end
end
|
#test_assert_output_nested_assert_uncaught ⇒ Object
626
627
628
629
630
631
632
633
634
635
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 626
def test_assert_output_nested_assert_uncaught
@assertion_count = 1
assert_triggered "Epic Fail!" do
@tc.assert_output "blah\n" do
puts "blah"
@tc.flunk
end
end
end
|
#test_assert_output_nested_raise ⇒ Object
637
638
639
640
641
642
643
644
645
646
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 637
def test_assert_output_nested_raise
@assertion_count = 2
@tc.assert_output "blah\n" do
@tc.assert_raises RuntimeError do
puts "blah"
raise "boom!"
end
end
end
|
#test_assert_output_nested_raise_bad ⇒ Object
648
649
650
651
652
653
654
655
656
657
658
659
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 648
def test_assert_output_nested_raise_bad
@assertion_count = 0
assert_unexpected "boom!" do
@tc.assert_raises do @tc.assert_output "blah\n" do puts "not_blah"
raise "boom!"
end
end
end
end
|
#test_assert_output_nested_raise_mismatch ⇒ Object
661
662
663
664
665
666
667
668
669
670
671
672
673
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 661
def test_assert_output_nested_raise_mismatch
@assertion_count = 0
assert_unexpected "boom!" do
@tc.assert_raises RuntimeError do @tc.assert_output "blah\n" do puts "not_blah"
raise ArgumentError, "boom!"
end
end
end
end
|
#test_assert_output_nested_throw_caught ⇒ Object
675
676
677
678
679
680
681
682
683
684
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 675
def test_assert_output_nested_throw_caught
@assertion_count = 2
@tc.assert_output "blah\n" do
@tc.assert_throws :boom! do
puts "blah"
throw :boom!
end
end
end
|
#test_assert_output_nested_throw_caught_bad ⇒ Object
686
687
688
689
690
691
692
693
694
695
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 686
def test_assert_output_nested_throw_caught_bad
@assertion_count = 1
@tc.assert_throws :boom! do @tc.assert_output "blah\n" do puts "not_blah"
throw :boom!
end
end
end
|
#test_assert_output_nested_throw_mismatch ⇒ Object
697
698
699
700
701
702
703
704
705
706
707
708
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 697
def test_assert_output_nested_throw_mismatch
@assertion_count = 0
assert_unexpected "uncaught throw :boom!" do
@tc.assert_throws :not_boom! do @tc.assert_output "blah\n" do puts "not_blah"
throw :boom!
end
end
end
end
|
#test_assert_output_no_block ⇒ Object
620
621
622
623
624
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 620
def test_assert_output_no_block
assert_triggered "assert_output requires a block to capture output." do
@tc.assert_output "blah"
end
end
|
#test_assert_output_out ⇒ Object
589
590
591
592
593
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 589
def test_assert_output_out
@tc.assert_output "blah" do
print "blah"
end
end
|
#test_assert_output_triggered_both ⇒ Object
595
596
597
598
599
600
601
602
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 595
def test_assert_output_triggered_both
assert_triggered util_msg("blah", "blah blah", "In stderr") do
@tc.assert_output "yay", "blah" do
print "boo"
$stderr.print "blah blah"
end
end
end
|
#test_assert_output_triggered_err ⇒ Object
604
605
606
607
608
609
610
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 604
def test_assert_output_triggered_err
assert_triggered util_msg("blah", "blah blah", "In stderr") do
@tc.assert_output nil, "blah" do
$stderr.print "blah blah"
end
end
end
|
#test_assert_output_triggered_out ⇒ Object
612
613
614
615
616
617
618
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 612
def test_assert_output_triggered_out
assert_triggered util_msg("blah", "blah blah", "In stdout") do
@tc.assert_output "blah" do
print "blah blah"
end
end
end
|
#test_assert_output_uncaught_raise ⇒ Object
710
711
712
713
714
715
716
717
718
719
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 710
def test_assert_output_uncaught_raise
@assertion_count = 0
assert_unexpected "RuntimeError: boom!" do
@tc.assert_output "blah\n" do
puts "not_blah"
raise "boom!"
end
end
end
|
#test_assert_output_uncaught_throw ⇒ Object
721
722
723
724
725
726
727
728
729
730
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 721
def test_assert_output_uncaught_throw
@assertion_count = 0
assert_unexpected "uncaught throw :boom!" do
@tc.assert_output "blah\n" do
puts "not_blah"
throw :boom!
end
end
end
|
#test_assert_path_exists ⇒ Object
1055
1056
1057
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1055
def test_assert_path_exists
@tc.assert_path_exists __FILE__
end
|
#test_assert_path_exists_triggered ⇒ Object
1059
1060
1061
1062
1063
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1059
def test_assert_path_exists_triggered
assert_triggered "Expected path 'blah' to exist." do
@tc.assert_path_exists "blah"
end
end
|
#test_assert_predicate ⇒ Object
731
732
733
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 731
def test_assert_predicate
@tc.assert_predicate "", :empty?
end
|
#test_assert_predicate_triggered ⇒ Object
735
736
737
738
739
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 735
def test_assert_predicate_triggered
assert_triggered 'Expected "blah" to be empty?.' do
@tc.assert_predicate "blah", :empty?
end
end
|
#test_assert_raises ⇒ Object
741
742
743
744
745
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 741
def test_assert_raises
@tc.assert_raises RuntimeError do
raise "blah"
end
end
|
#test_assert_raises_default ⇒ Object
747
748
749
750
751
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 747
def test_assert_raises_default
@tc.assert_raises do
raise StandardError, "blah"
end
end
|
#test_assert_raises_default_triggered ⇒ Object
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 753
def test_assert_raises_default_triggered
e = assert_raises Minitest::Assertion do
@tc.assert_raises do
raise SomeError, "blah"
end
end
expected = clean <<-EOM.chomp
[StandardError] exception expected, not
Class: <SomeError>
Message: <\"blah\">
---Backtrace---
FILE:LINE:in \`block in test_assert_raises_default_triggered\'
---------------
EOM
actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
actual.gsub!(RE_LEVELS, "") unless jruby?
assert_equal expected, actual
end
|
#test_assert_raises_exit ⇒ Object
775
776
777
778
779
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 775
def test_assert_raises_exit
@tc.assert_raises SystemExit do
exit 1
end
end
|
#test_assert_raises_module ⇒ Object
781
782
783
784
785
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 781
def test_assert_raises_module
@tc.assert_raises MyModule do
raise AnError
end
end
|
#test_assert_raises_signals ⇒ Object
787
788
789
790
791
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 787
def test_assert_raises_signals
@tc.assert_raises SignalException do
raise SignalException, :INT
end
end
|
#test_assert_raises_skip ⇒ Object
812
813
814
815
816
817
818
819
820
821
822
823
824
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 812
def test_assert_raises_skip
@assertion_count = 0
assert_triggered "skipped", Minitest::Skip do
@tc.assert_raises ArgumentError do
begin
raise "blah"
rescue
skip "skipped"
end
end
end
end
|
#test_assert_raises_subclass ⇒ Object
826
827
828
829
830
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 826
def test_assert_raises_subclass
@tc.assert_raises StandardError do
raise AnError
end
end
|
#test_assert_raises_subclass_triggered ⇒ Object
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 832
def test_assert_raises_subclass_triggered
e = assert_raises Minitest::Assertion do
@tc.assert_raises SomeError do
raise AnError, "some message"
end
end
expected = clean <<-EOM
[SomeError] exception expected, not
Class: <AnError>
Message: <\"some message\">
---Backtrace---
FILE:LINE:in \`block in test_assert_raises_subclass_triggered\'
---------------
EOM
actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
actual.gsub!(RE_LEVELS, "") unless jruby?
assert_equal expected.chomp, actual
end
|
#test_assert_raises_throw_nested_bad ⇒ Object
793
794
795
796
797
798
799
800
801
802
803
804
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 793
def test_assert_raises_throw_nested_bad
@assertion_count = 0
assert_unexpected "RuntimeError: boom!" do
@tc.assert_raises do
@tc.assert_throws :blah do
raise "boom!"
throw :not_blah
end
end
end
end
|
#test_assert_raises_triggered_different ⇒ Object
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 854
def test_assert_raises_triggered_different
e = assert_raises Minitest::Assertion do
@tc.assert_raises RuntimeError do
raise SyntaxError, "icky"
end
end
expected = clean <<-EOM.chomp
[RuntimeError] exception expected, not
Class: <SyntaxError>
Message: <\"icky\">
---Backtrace---
FILE:LINE:in \`block in test_assert_raises_triggered_different\'
---------------
EOM
actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
actual.gsub!(RE_LEVELS, "") unless jruby?
assert_equal expected, actual
end
|
#test_assert_raises_triggered_different_msg ⇒ Object
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 876
def test_assert_raises_triggered_different_msg
e = assert_raises Minitest::Assertion do
@tc.assert_raises RuntimeError, "XXX" do
raise SyntaxError, "icky"
end
end
expected = clean <<-EOM
XXX.
[RuntimeError] exception expected, not
Class: <SyntaxError>
Message: <\"icky\">
---Backtrace---
FILE:LINE:in \`block in test_assert_raises_triggered_different_msg\'
---------------
EOM
actual = e.message.gsub(/^.+:\d+/, "FILE:LINE")
actual.gsub!(RE_LEVELS, "") unless jruby?
assert_equal expected.chomp, actual
end
|
#test_assert_raises_triggered_none ⇒ Object
899
900
901
902
903
904
905
906
907
908
909
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 899
def test_assert_raises_triggered_none
e = assert_raises Minitest::Assertion do
@tc.assert_raises Minitest::Assertion do
end
end
expected = "Minitest::Assertion expected but nothing was raised."
assert_equal expected, e.message
end
|
#test_assert_raises_triggered_none_msg ⇒ Object
911
912
913
914
915
916
917
918
919
920
921
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 911
def test_assert_raises_triggered_none_msg
e = assert_raises Minitest::Assertion do
@tc.assert_raises Minitest::Assertion, "XXX" do
end
end
expected = "XXX.\nMinitest::Assertion expected but nothing was raised."
assert_equal expected, e.message
end
|
#test_assert_raises_without_block ⇒ Object
923
924
925
926
927
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 923
def test_assert_raises_without_block
assert_triggered "assert_raises requires a block to capture errors." do
@tc.assert_raises StandardError
end
end
|
#test_assert_respond_to ⇒ Object
929
930
931
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 929
def test_assert_respond_to
@tc.assert_respond_to "blah", :empty?
end
|
#test_assert_respond_to_triggered ⇒ Object
933
934
935
936
937
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 933
def test_assert_respond_to_triggered
assert_triggered 'Expected "blah" (String) to respond to #rawr!.' do
@tc.assert_respond_to "blah", :rawr!
end
end
|
#test_assert_same ⇒ Object
939
940
941
942
943
944
945
946
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 939
def test_assert_same
@assertion_count = 3
o = "blah"
@tc.assert_same 1, 1
@tc.assert_same :blah, :blah
@tc.assert_same o, o
end
|
#test_assert_same_triggered ⇒ Object
948
949
950
951
952
953
954
955
956
957
958
959
960
961
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 948
def test_assert_same_triggered
@assertion_count = 2
assert_triggered "Expected 2 (oid=N) to be the same as 1 (oid=N)." do
@tc.assert_same 1, 2
end
s1 = "blah"
s2 = "blah"
assert_triggered 'Expected "blah" (oid=N) to be the same as "blah" (oid=N).' do
@tc.assert_same s1, s2
end
end
|
#test_assert_send ⇒ Object
963
964
965
966
967
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 963
def test_assert_send
assert_deprecated :assert_send do
@tc.assert_send [1, :<, 2]
end
end
|
#test_assert_send_bad ⇒ Object
969
970
971
972
973
974
975
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 969
def test_assert_send_bad
assert_deprecated :assert_send do
assert_triggered "Expected 1.>(*[2]) to return true." do
@tc.assert_send [1, :>, 2]
end
end
end
|
#test_assert_silent ⇒ Object
977
978
979
980
981
982
983
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 977
def test_assert_silent
@assertion_count = 2
@tc.assert_silent do
end
end
|
#test_assert_silent_triggered_err ⇒ Object
985
986
987
988
989
990
991
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 985
def test_assert_silent_triggered_err
assert_triggered util_msg("", "blah blah", "In stderr") do
@tc.assert_silent do
$stderr.print "blah blah"
end
end
end
|
#test_assert_silent_triggered_out ⇒ Object
993
994
995
996
997
998
999
1000
1001
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 993
def test_assert_silent_triggered_out
@assertion_count = 2
assert_triggered util_msg("", "blah blah", "In stdout") do
@tc.assert_silent do
print "blah blah"
end
end
end
|
#test_assert_throws ⇒ Object
1003
1004
1005
1006
1007
1008
1009
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1003
def test_assert_throws
v = @tc.assert_throws :blah do
throw :blah
end
assert_nil v
end
|
#test_assert_throws_argument_exception ⇒ Object
1019
1020
1021
1022
1023
1024
1025
1026
1027
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1019
def test_assert_throws_argument_exception
@assertion_count = 0
assert_unexpected "ArgumentError" do
@tc.assert_throws :blah do
raise ArgumentError
end
end
end
|
#test_assert_throws_different ⇒ Object
1029
1030
1031
1032
1033
1034
1035
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1029
def test_assert_throws_different
assert_triggered "Expected :blah to have been thrown, not :not_blah." do
@tc.assert_throws :blah do
throw :not_blah
end
end
end
|
#test_assert_throws_name_error ⇒ Object
1037
1038
1039
1040
1041
1042
1043
1044
1045
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1037
def test_assert_throws_name_error
@assertion_count = 0
assert_unexpected "NameError" do
@tc.assert_throws :blah do
raise NameError
end
end
end
|
#test_assert_throws_unthrown ⇒ Object
1047
1048
1049
1050
1051
1052
1053
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1047
def test_assert_throws_unthrown
assert_triggered "Expected :blah to have been thrown." do
@tc.assert_throws :blah do
end
end
end
|
#test_assert_throws_value ⇒ Object
1011
1012
1013
1014
1015
1016
1017
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1011
def test_assert_throws_value
v = @tc.assert_throws :blah do
throw :blah, 42
end
assert_equal 42, v
end
|
#test_capture_io ⇒ Object
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1065
def test_capture_io
@assertion_count = 0
non_verbose do
out, err = capture_io do
puts "hi"
$stderr.puts "bye!"
end
assert_equal "hi\n", out
assert_equal "bye!\n", err
end
end
|
#test_capture_subprocess_io ⇒ Object
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1079
def test_capture_subprocess_io
@assertion_count = 0
non_verbose do
out, err = capture_subprocess_io do
system("echo hi")
system("echo bye! 1>&2")
end
assert_equal "hi\n", out
assert_equal "bye!", err.strip
end
end
|
#test_class_asserts_match_refutes ⇒ Object
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1093
def test_class_asserts_match_refutes
@assertion_count = 0
methods = Minitest::Assertions.public_instance_methods
methods.map!(&:to_s) if Symbol === methods.first
ignores = %w[assert_output assert_raises assert_send
assert_silent assert_throws assert_mock]
ignores += %w[assert_no_match assert_not_equal assert_not_nil
assert_not_same assert_nothing_raised
assert_nothing_thrown assert_raise]
asserts = methods.grep(/^assert/).sort - ignores
refutes = methods.grep(/^refute/).sort - ignores
assert_empty refutes.map { |n| n.sub(/^refute/, "assert") } - asserts
assert_empty asserts.map { |n| n.sub(/^assert/, "refute") } - refutes
end
|
#test_delta_consistency ⇒ Object
1116
1117
1118
1119
1120
1121
1122
1123
1124
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1116
def test_delta_consistency
@assertion_count = 2
@tc.assert_in_delta 0, 1, 1
assert_triggered "Expected |0 - 1| (1) to not be <= 1." do
@tc.refute_in_delta 0, 1, 1
end
end
|
#test_epsilon_consistency ⇒ Object
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1126
def test_epsilon_consistency
@assertion_count = 2
@tc.assert_in_epsilon 1.0, 1.001
msg = "Expected |1.0 - 1.001| (0.000999xxx) to not be <= 0.001."
assert_triggered msg do
@tc.refute_in_epsilon 1.0, 1.001
end
end
|
#test_fail_after ⇒ Object
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1141
def test_fail_after
d0 = Time.now
d1 = d0 + 86_400
assert_silent do
assert_fail_after d1
end
assert_triggered "remove the deprecations" do
assert_fail_after d0
end
end
|
#test_flunk ⇒ Object
1154
1155
1156
1157
1158
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1154
def test_flunk
assert_triggered "Epic Fail!" do
@tc.flunk
end
end
|
#test_flunk_message ⇒ Object
1160
1161
1162
1163
1164
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1160
def test_flunk_message
assert_triggered @zomg do
@tc.flunk @zomg
end
end
|
#test_pass ⇒ Object
1166
1167
1168
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1166
def test_pass
@tc.pass
end
|
#test_refute ⇒ Object
1170
1171
1172
1173
1174
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1170
def test_refute
@assertion_count = 2
@tc.assert_equal true, @tc.refute(false), "returns true on success"
end
|
#test_refute_empty ⇒ Object
1176
1177
1178
1179
1180
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1176
def test_refute_empty
@assertion_count = 2
@tc.refute_empty [1]
end
|
#test_refute_empty_triggered ⇒ Object
1182
1183
1184
1185
1186
1187
1188
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1182
def test_refute_empty_triggered
@assertion_count = 2
assert_triggered "Expected [] to not be empty." do
@tc.refute_empty []
end
end
|
#test_refute_equal ⇒ Object
1190
1191
1192
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1190
def test_refute_equal
@tc.refute_equal "blah", "yay"
end
|
#test_refute_equal_triggered ⇒ Object
1194
1195
1196
1197
1198
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1194
def test_refute_equal_triggered
assert_triggered 'Expected "blah" to not be equal to "blah".' do
@tc.refute_equal "blah", "blah"
end
end
|
#test_refute_in_delta ⇒ Object
1200
1201
1202
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1200
def test_refute_in_delta
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.000001
end
|
#test_refute_in_delta_triggered ⇒ Object
1204
1205
1206
1207
1208
1209
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1204
def test_refute_in_delta_triggered
x = "0.1"
assert_triggered "Expected |0.0 - 0.001| (0.001) to not be <= #{x}." do
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
end
end
|
#test_refute_in_epsilon ⇒ Object
1211
1212
1213
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1211
def test_refute_in_epsilon
@tc.refute_in_epsilon 10_000, 9990-1
end
|
#test_refute_in_epsilon_triggered ⇒ Object
1215
1216
1217
1218
1219
1220
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1215
def test_refute_in_epsilon_triggered
assert_triggered "Expected |10000 - 9990| (10) to not be <= 10.0." do
@tc.refute_in_epsilon 10_000, 9990
flunk
end
end
|
#test_refute_includes ⇒ Object
1222
1223
1224
1225
1226
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1222
def test_refute_includes
@assertion_count = 2
@tc.refute_includes [true], false
end
|
#test_refute_includes_triggered ⇒ Object
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1228
def test_refute_includes_triggered
@assertion_count = 3
e = @tc.assert_raises Minitest::Assertion do
@tc.refute_includes [true], true
end
expected = "Expected [true] to not include true."
assert_equal expected, e.message
end
|
#test_refute_instance_of ⇒ Object
1239
1240
1241
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1239
def test_refute_instance_of
@tc.refute_instance_of Array, "blah"
end
|
#test_refute_instance_of_triggered ⇒ Object
1243
1244
1245
1246
1247
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1243
def test_refute_instance_of_triggered
assert_triggered 'Expected "blah" to not be an instance of String.' do
@tc.refute_instance_of String, "blah"
end
end
|
#test_refute_kind_of ⇒ Object
1249
1250
1251
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1249
def test_refute_kind_of
@tc.refute_kind_of Array, "blah"
end
|
#test_refute_kind_of_triggered ⇒ Object
1253
1254
1255
1256
1257
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1253
def test_refute_kind_of_triggered
assert_triggered 'Expected "blah" to not be a kind of String.' do
@tc.refute_kind_of String, "blah"
end
end
|
#test_refute_match ⇒ Object
1259
1260
1261
1262
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1259
def test_refute_match
@assertion_count = 2
@tc.refute_match(/\d+/, "blah blah blah")
end
|
#test_refute_match_matcher_object ⇒ Object
1264
1265
1266
1267
1268
1269
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1264
def test_refute_match_matcher_object
@assertion_count = 2
pattern = Object.new
def pattern.=~ _; false end
@tc.refute_match pattern, 5
end
|
#test_refute_match_object_triggered ⇒ Object
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1271
def test_refute_match_object_triggered
@assertion_count = 2
pattern = Object.new
def pattern.=~ _; true end
def pattern.inspect; "[Object]" end
assert_triggered "Expected [Object] to not match 5." do
@tc.refute_match pattern, 5
end
end
|
#test_refute_match_triggered ⇒ Object
1283
1284
1285
1286
1287
1288
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1283
def test_refute_match_triggered
@assertion_count = 2
assert_triggered 'Expected /\w+/ to not match "blah blah blah".' do
@tc.refute_match(/\w+/, "blah blah blah")
end
end
|
#test_refute_nil ⇒ Object
1290
1291
1292
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1290
def test_refute_nil
@tc.refute_nil 42
end
|
#test_refute_nil_triggered ⇒ Object
1294
1295
1296
1297
1298
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1294
def test_refute_nil_triggered
assert_triggered "Expected nil to not be nil." do
@tc.refute_nil nil
end
end
|
#test_refute_operator ⇒ Object
1300
1301
1302
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1300
def test_refute_operator
@tc.refute_operator 2, :<, 1
end
|
#test_refute_operator_bad_object ⇒ Object
1304
1305
1306
1307
1308
1309
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1304
def test_refute_operator_bad_object
bad = Object.new
def bad.== _; true end
@tc.refute_operator true, :equal?, bad
end
|
#test_refute_operator_triggered ⇒ Object
1311
1312
1313
1314
1315
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1311
def test_refute_operator_triggered
assert_triggered "Expected 2 to not be > 1." do
@tc.refute_operator 2, :>, 1
end
end
|
#test_refute_path_exists ⇒ Object
1347
1348
1349
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1347
def test_refute_path_exists
@tc.refute_path_exists "blah"
end
|
#test_refute_path_exists_triggered ⇒ Object
1351
1352
1353
1354
1355
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1351
def test_refute_path_exists_triggered
assert_triggered "Expected path '#{__FILE__}' to not exist." do
@tc.refute_path_exists __FILE__
end
end
|
#test_refute_predicate ⇒ Object
1317
1318
1319
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1317
def test_refute_predicate
@tc.refute_predicate "42", :empty?
end
|
#test_refute_predicate_triggered ⇒ Object
1321
1322
1323
1324
1325
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1321
def test_refute_predicate_triggered
assert_triggered 'Expected "" to not be empty?.' do
@tc.refute_predicate "", :empty?
end
end
|
#test_refute_respond_to ⇒ Object
1327
1328
1329
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1327
def test_refute_respond_to
@tc.refute_respond_to "blah", :rawr!
end
|
#test_refute_respond_to_triggered ⇒ Object
1331
1332
1333
1334
1335
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1331
def test_refute_respond_to_triggered
assert_triggered 'Expected "blah" to not respond to empty?.' do
@tc.refute_respond_to "blah", :empty?
end
end
|
#test_refute_same ⇒ Object
1337
1338
1339
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1337
def test_refute_same
@tc.refute_same 1, 2
end
|
#test_refute_same_triggered ⇒ Object
1341
1342
1343
1344
1345
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1341
def test_refute_same_triggered
assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do
@tc.refute_same 1, 1
end
end
|
#test_skip ⇒ Object
1357
1358
1359
1360
1361
1362
1363
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1357
def test_skip
@assertion_count = 0
assert_triggered "haha!", Minitest::Skip do
@tc.skip "haha!"
end
end
|
#test_skip_until ⇒ Object
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1369
def test_skip_until
@assertion_count = 0
d0 = Time.now
d1 = d0 + 86_400
assert_output "", /Stale skip_until \"not yet\" at .*?:\d+$/ do
assert_skip_until d0, "not yet"
end
assert_triggered "not ready yet", Minitest::Skip do
assert_skip_until d1, "not ready yet"
end
end
|
#util_msg(exp, act, msg = nil) ⇒ Object
1384
1385
1386
1387
1388
|
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_assertions.rb', line 1384
def util_msg exp, act, msg = nil
s = "Expected: #{exp.inspect}\n Actual: #{act.inspect}"
s = "#{msg}.\n#{s}" if msg
s
end
|