Class: MetaMetaMetaTestCase

Inherits:
Minitest::Test show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb

Constant Summary

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

Minitest::Runnable::SIGNALS

Instance Attribute Summary collapse

Attributes inherited from Minitest::Runnable

#assertions, #failures, #time

Instance Method Summary collapse

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, #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 Attribute Details

#outputObject

Returns the value of attribute output.



45
46
47
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 45

def output
  @output
end

#reporterObject

Returns the value of attribute reporter.



45
46
47
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 45

def reporter
  @reporter
end

#tuObject

Returns the value of attribute tu.



45
46
47
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 45

def tu
  @tu
end

Instance Method Details

#assert_report(expected, flags = %w[--seed 42], &block) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 84

def assert_report expected, flags = %w[--seed 42], &block
  header = clean <<-EOM
    Run options: #{flags.map { |s| s =~ /\|/ ? s.inspect : s }.join " "}

    # Running:

  EOM

  run_tu_with_fresh_reporter flags, &block

  output = normalize_output @output.string.dup

  assert_equal header + expected, output
end

#first_reporterObject



80
81
82
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 80

def first_reporter
  reporter.reporters.first
end

#normalize_output(output) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 99

def normalize_output output
  output.sub!(/Finished in .*/, "Finished in 0.00")
  output.sub!(/Loaded suite .*/, "Loaded suite blah")

  output.gsub!(/FakeNamedTest\d+/, "FakeNamedTestXX")
  output.gsub!(/ = \d+.\d\d s = /, " = 0.00 s = ")
  output.gsub!(/0x[A-Fa-f0-9]+/, "0xXXX")
  output.gsub!(/ +$/, "")

  if windows? then
    output.gsub!(/\[(?:[A-Za-z]:)?[^\]:]+:\d+\]/, "[FILE:LINE]")
    output.gsub!(/^(\s+)(?:[A-Za-z]:)?[^:]+:\d+:in/, '\1FILE:LINE:in')
  else
    output.gsub!(/\[[^\]:]+:\d+\]/, "[FILE:LINE]")
    output.gsub!(/^(\s+)[^:]+:\d+:in/, '\1FILE:LINE:in')
  end

  output.gsub!(/( at )[^:]+:\d+/, '\1[FILE:LINE]')

  output
end

#restore_envObject



121
122
123
124
125
126
127
128
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 121

def restore_env
  old_value = ENV["MT_NO_SKIP_MSG"]
  ENV.delete "MT_NO_SKIP_MSG"

  yield
ensure
  ENV["MT_NO_SKIP_MSG"] = old_value
end

#run_tu_with_fresh_reporter(flags = %w[--seed 42]) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 55

def run_tu_with_fresh_reporter flags = %w[--seed 42]
  options = Minitest.process_args flags

  @output = StringIO.new("".encode('UTF-8'))

  self.reporter = Minitest::CompositeReporter.new
  reporter << Minitest::SummaryReporter.new(@output, options)
  reporter << Minitest::ProgressReporter.new(@output, options)

  with_stderr @output do
    reporter.start

    yield(reporter) if block_given?

    @tus ||= [@tu]
    @tus.each do |tu|
      Minitest::Runnable.runnables.delete tu

      tu.run reporter, options
    end

    reporter.report
  end
end

#setupObject



130
131
132
133
134
135
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 130

def setup
  super
  Minitest.seed = 42
  Minitest::Test.reset
  @tu = nil
end

#with_stderr(err) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/test/minitest/metametameta.rb', line 47

def with_stderr err
  old = $stderr
  $stderr = err
  yield
ensure
  $stderr = old
end