Class: TestMinitestUnitTestCase
- Inherits:
-
Minitest::Test
- Object
- Minitest::Runnable
- Minitest::Test
- TestMinitestUnitTestCase
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb
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
Constants inherited from Minitest::Test
Minitest::Test::PASSTHROUGH_EXCEPTIONS, Minitest::Test::SETUP_METHODS, Minitest::Test::TEARDOWN_METHODS
Constants included from Minitest::Assertions
Minitest::Assertions::E, Minitest::Assertions::UNDEFINED
Constants inherited from Minitest::Runnable
Instance Attribute Summary
Attributes inherited from Minitest::Runnable
Instance Method Summary collapse
- #non_verbose ⇒ Object
- #sample_test_case(rand) ⇒ Object
- #setup ⇒ Object
- #teardown ⇒ Object
- #test_autorun_does_not_affect_fork_exit_status ⇒ Object
- #test_autorun_does_not_affect_fork_success_status ⇒ Object
- #test_i_suck_and_my_tests_are_order_dependent_bang_does_not_warn ⇒ Object
- #test_i_suck_and_my_tests_are_order_dependent_bang_sets_test_order_alpha ⇒ Object
-
#test_runnable_methods_random ⇒ Object
srand varies with OS.
- #test_runnable_methods_sorted ⇒ Object
Methods inherited from Minitest::Test
#capture_exceptions, #class_name, #clean, 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
Methods included from Minitest::Guard
#jruby?, #maglev?, #mri?, #osx?, #rubinius?, #windows?
Methods included from Minitest::Test::LifecycleHooks
#after_setup, #after_teardown, #before_setup, #before_teardown
Methods included from Minitest::Reportable
#class_name, #error?, #location, #passed?, #result_code, #skipped?
Methods included from Minitest::Assertions
#_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
Methods inherited from Minitest::Runnable
#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
Constructor Details
This class inherits a constructor from Minitest::Runnable
Instance Method Details
#non_verbose ⇒ Object
1024 1025 1026 1027 1028 1029 1030 1031 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1024 def non_verbose orig_verbose = $VERBOSE $VERBOSE = false yield ensure $VERBOSE = orig_verbose end |
#sample_test_case(rand) ⇒ Object
1033 1034 1035 1036 1037 1038 1039 1040 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1033 def sample_test_case(rand) srand rand Class.new FakeNamedTest do 100.times do |i| define_method("test_#{i}") { assert true } end end.runnable_methods end |
#setup ⇒ Object
1009 1010 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_test.rb', line 1009 def setup super Minitest::Test.reset @tc = Minitest::Test.new "fake tc" @zomg = "zomg ponies!" @assertion_count = 1 end |
#teardown ⇒ Object
1019 1020 1021 1022 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1019 def teardown assert_equal(@assertion_count, @tc.assertions, "expected #{@assertion_count} assertions to be fired during the test, not #{@tc.assertions}") if @tc.passed? end |
#test_autorun_does_not_affect_fork_exit_status ⇒ Object
1097 1098 1099 1100 1101 1102 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1097 def test_autorun_does_not_affect_fork_exit_status @assertion_count = 0 skip "windows doesn't have skip" unless Process.respond_to?(:fork) Process.waitpid(fork { exit 42 }) assert_equal 42, $?.exitstatus end |
#test_autorun_does_not_affect_fork_success_status ⇒ Object
1090 1091 1092 1093 1094 1095 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1090 def test_autorun_does_not_affect_fork_success_status @assertion_count = 0 skip "windows doesn't have skip" unless Process.respond_to?(:fork) Process.waitpid(fork {}) assert_equal true, $?.success? end |
#test_i_suck_and_my_tests_are_order_dependent_bang_does_not_warn ⇒ Object
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1078 def test_i_suck_and_my_tests_are_order_dependent_bang_does_not_warn @assertion_count = 0 shitty_test_case = Class.new FakeNamedTest def shitty_test_case.test_order; :lol end assert_silent do shitty_test_case.i_suck_and_my_tests_are_order_dependent! end end |
#test_i_suck_and_my_tests_are_order_dependent_bang_sets_test_order_alpha ⇒ Object
1068 1069 1070 1071 1072 1073 1074 1075 1076 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1068 def test_i_suck_and_my_tests_are_order_dependent_bang_sets_test_order_alpha @assertion_count = 0 shitty_test_case = Class.new FakeNamedTest shitty_test_case.i_suck_and_my_tests_are_order_dependent! assert_equal :alpha, shitty_test_case.test_order end |
#test_runnable_methods_random ⇒ Object
srand varies with OS
1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1043 def test_runnable_methods_random @assertion_count = 0 random_tests_1 = sample_test_case 42 random_tests_2 = sample_test_case 42 random_tests_3 = sample_test_case 1_000 assert_equal random_tests_1, random_tests_2 assert_equal random_tests_1, random_tests_3 end |
#test_runnable_methods_sorted ⇒ Object
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/test_minitest_test.rb', line 1054 def test_runnable_methods_sorted @assertion_count = 0 sample_test_case = Class.new FakeNamedTest do def self.test_order; :sorted end def test_test3; assert "does not matter" end def test_test2; assert "does not matter" end def test_test1; assert "does not matter" end end expected = %w[test_test1 test_test2 test_test3] assert_equal expected, sample_test_case.runnable_methods end |