-
Notifications
You must be signed in to change notification settings - Fork 68
Support Minitest v6 #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
S-H-GAMELINKS
wants to merge
1
commit into
tmm1:master
Choose a base branch
from
S-H-GAMELINKS:support/minitest6
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Support Minitest v6 #138
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # This file was generated by Appraisal | ||
|
|
||
| source 'https://rubygems.org' | ||
|
|
||
| gem 'minitest', '~> 6.0' | ||
| gem 'rake' | ||
|
|
||
| gemspec path: '../' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require_relative '../runner' | ||
|
|
||
| module Minitest | ||
| def self.run_all_suites(reporter, options) | ||
| suites = Runnable.runnables | ||
| suites.map { |suite| suite.run_suite reporter, options } | ||
| end | ||
|
|
||
| class Runnable | ||
| def failure_count | ||
| failures.length | ||
| end | ||
| end | ||
|
|
||
| class Test | ||
| def self.runnables=(runnables) | ||
| @@runnables = runnables | ||
| end | ||
|
|
||
| # Synchronize all tests, even serial ones. | ||
| # | ||
| # Minitest runs serial tests before parallel ones to ensure the | ||
| # unsynchronized serial tests don't overlap the parallel tests. But since | ||
| # the test-queue master hands out tests without actually loading their | ||
| # code, there's no way to know which are parallel and which are serial. | ||
| # Synchronizing serial tests does add some overhead, but hopefully this is | ||
| # outweighed by the speed benefits of using test-queue. | ||
| def _synchronize | ||
| Test.io_lock.synchronize { yield } | ||
| end | ||
| end | ||
|
|
||
| class ProgressReporter | ||
| # Override original method to make test-queue specific output | ||
| def record(result) | ||
| io.print ' ' | ||
| io.print result.klass | ||
| io.print ': ' | ||
| io.print result.result_code | ||
| io.puts(' <%.3f>' % result.time) | ||
| end | ||
| end | ||
|
|
||
| begin | ||
| require 'minitest/minitest_reporter_plugin' | ||
|
|
||
| class << self | ||
| private | ||
|
|
||
| def total_count(_options) | ||
| 0 | ||
| end | ||
| end | ||
| rescue LoadError | ||
| # noop | ||
| end | ||
| end | ||
|
|
||
| module TestQueue | ||
| class Runner | ||
| class Minitest < Runner | ||
| def initialize | ||
| @options = ::Minitest.process_args ARGV | ||
|
|
||
| if ::Minitest.respond_to?(:seed) | ||
| ::Minitest.seed = @options[:seed] | ||
| srand ::Minitest.seed | ||
| end | ||
|
|
||
| if ::Minitest::Test.runnables.any? { |r| r.runnable_methods.any? } | ||
| raise 'Do not `require` test files. Pass them via ARGV instead and they will be required as needed.' | ||
| end | ||
|
|
||
| super(TestFramework::Minitest.new) | ||
| end | ||
|
|
||
| def start_master | ||
| puts "Run options: #{@options[:args]}\n\n" | ||
|
|
||
| super | ||
| end | ||
|
|
||
| def run_worker(iterator) | ||
| ::Minitest::Test.runnables = iterator | ||
| ::Minitest.run ? 0 : 1 | ||
| end | ||
| end | ||
| end | ||
|
|
||
| class TestFramework | ||
| class Minitest < TestFramework | ||
| def all_suite_files | ||
| ARGV | ||
| end | ||
|
|
||
| def suites_from_file(path) | ||
| ::Minitest::Test.reset | ||
| require File.absolute_path(path) | ||
| ::Minitest::Test.runnables | ||
| .reject { |s| s.runnable_methods.empty? } | ||
| .map { |s| [s.name, s] } | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'minitest/spec' | ||
|
|
||
| class Meme | ||
| def i_can_has_cheezburger? | ||
| 'OHAI!' | ||
| end | ||
|
|
||
| def will_it_blend? | ||
| 'YES!' | ||
| end | ||
| end | ||
|
|
||
| describe Meme do | ||
| before do | ||
| @meme = Meme.new | ||
| end | ||
|
|
||
| describe 'when asked about cheeseburgers' do | ||
| it 'must respond positively' do | ||
| sleep 0.1 | ||
| _(@meme.i_can_has_cheezburger?).must_equal 'OHAI!' | ||
| end | ||
| end | ||
|
|
||
| describe 'when asked about blending possibilities' do | ||
| it "won't say no" do | ||
| sleep 0.1 | ||
| _(@meme.will_it_blend?).wont_match(/^no/i) | ||
| end | ||
|
|
||
| if ENV['FAIL'] | ||
| it 'fails' do | ||
| _(@meme.will_it_blend?).must_equal 'NO!' | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| require 'minitest/autorun' | ||
|
|
||
| class MinitestEqual < Minitest::Test | ||
| def test_equal | ||
| assert_equal 1, 1 | ||
| end | ||
| end | ||
|
|
||
| 30.times do |i| | ||
| Object.const_set("MinitestSleep#{i}", Class.new(Minitest::Test) do | ||
| define_method(:test_sleep) do | ||
| start = Time.now | ||
| sleep(0.25) | ||
| assert_in_delta Time.now - start, 0.25, 0.02 | ||
| end | ||
| end) | ||
| end | ||
|
|
||
| if ENV['FAIL'] | ||
| class MinitestFailure < Minitest::Test | ||
| def test_fail | ||
| assert_equal 0, 1 | ||
| end | ||
| end | ||
| end | ||
|
|
||
| if ENV['KILL'] | ||
| class MinitestKilledFailure < Minitest::Test | ||
| def test_kill | ||
| Process.kill(9, $$) | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update it using
case?