m 1.6.1 → 1.7.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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby-ci.yml +15 -10
  3. data/.gitignore +1 -0
  4. data/.standard.yml +1 -0
  5. data/Gemfile +6 -6
  6. data/README.md +4 -40
  7. data/Rakefile +13 -87
  8. data/bin/m +2 -2
  9. data/lib/error_tests/error_test.rb +1 -1
  10. data/lib/m/executor.rb +23 -24
  11. data/lib/m/finish_line.rb +83 -0
  12. data/lib/m/frameworks.rb +27 -23
  13. data/lib/m/parser.rb +33 -33
  14. data/lib/m/runner.rb +3 -3
  15. data/lib/m/runners/base.rb +4 -4
  16. data/lib/m/runners/minitest_4.rb +1 -1
  17. data/lib/m/runners/minitest_5.rb +3 -5
  18. data/lib/m/runners/minitest_6.rb +3 -0
  19. data/lib/m/runners/test_unit.rb +6 -6
  20. data/lib/m/runners/unsupported_framework.rb +2 -2
  21. data/lib/m/test_collection.rb +5 -5
  22. data/lib/m/test_method.rb +13 -18
  23. data/lib/m/testable.rb +2 -2
  24. data/lib/m/version.rb +1 -1
  25. data/lib/m.rb +4 -4
  26. data/m.gemspec +14 -16
  27. data/test/Rakefile +2 -2
  28. data/test/active_support_test.rb +22 -17
  29. data/test/allocations.rb +10 -13
  30. data/test/bench.rb +10 -17
  31. data/test/empty_test.rb +2 -2
  32. data/test/everything_test.rb +8 -12
  33. data/test/examples/active_support_example_test.rb +2 -5
  34. data/test/examples/active_support_unescaped_example_test.rb +2 -5
  35. data/test/examples/empty_example_test.rb +1 -1
  36. data/test/examples/{minitest_5_example_test.rb → minitest_5_or_6_example_test.rb} +2 -2
  37. data/test/examples/minitest_example_test.rb +3 -5
  38. data/test/examples/multiple_example_test.rb +3 -3
  39. data/test/examples/subdir/a_test.rb +1 -1
  40. data/test/examples/subdir/another_subdir/d_test.rb +1 -1
  41. data/test/examples/subdir/another_subdir/yet_another_subdir/e_test.rb +1 -1
  42. data/test/examples/subdir/b_test.rb +1 -1
  43. data/test/examples/subdir/c_test.rb +1 -1
  44. data/test/examples/subdir_with_failures/a_test.rb +1 -1
  45. data/test/examples/test_unit_example_test.rb +2 -2
  46. data/test/exit_codes_test.rb +7 -7
  47. data/test/{minitest_5_test.rb → minitest_test.rb} +18 -12
  48. data/test/multiple_test.rb +4 -4
  49. data/test/options_test.rb +14 -14
  50. data/test/test_helper.rb +18 -24
  51. data/test/test_unit_test.rb +14 -9
  52. metadata +17 -95
  53. data/.travis.yml +0 -19
  54. data/Appraisals +0 -11
  55. data/Gemfile.lock +0 -74
  56. data/gemfiles/minitest4.gemfile +0 -10
  57. data/gemfiles/minitest4.gemfile.lock +0 -73
  58. data/gemfiles/minitest5.gemfile +0 -10
  59. data/gemfiles/minitest5.gemfile.lock +0 -73
  60. data/gemfiles/test_unit_gem.gemfile +0 -10
  61. data/gemfiles/test_unit_gem.gemfile.lock +0 -76
  62. data/test/examples/minitest_4_example_test.rb +0 -34
  63. data/test/minitest_4_test.rb +0 -39
data/lib/m/runner.rb CHANGED
@@ -1,11 +1,11 @@
1
- require_relative 'parser'
2
- require_relative 'executor'
1
+ require_relative "parser"
2
+ require_relative "executor"
3
3
 
4
4
  ### Runners are in charge of running your tests, depending on the framework
5
5
  # Instead of slamming all of this junk in an `M` class, it's here instead.
6
6
  module M
7
7
  class Runner
8
- def initialize(argv)
8
+ def initialize argv
9
9
  @argv = argv
10
10
  end
11
11
 
@@ -2,14 +2,14 @@ module M
2
2
  module Runners
3
3
  class Base
4
4
  def suites
5
- raise 'Not implemented'
5
+ raise "Not implemented"
6
6
  end
7
7
 
8
- def run(_test_arguments)
9
- raise 'Not implemented'
8
+ def run _test_arguments
9
+ raise "Not implemented"
10
10
  end
11
11
 
12
- def test_methods(suite_class)
12
+ def test_methods suite_class
13
13
  suite_class.test_methods
14
14
  end
15
15
  end
@@ -5,7 +5,7 @@ module M
5
5
  MiniTest::Unit::TestCase.test_suites
6
6
  end
7
7
 
8
- def run(test_arguments)
8
+ def run test_arguments
9
9
  MiniTest::Unit.runner.run test_arguments
10
10
  end
11
11
  end
@@ -2,19 +2,17 @@ module M
2
2
  module Runners
3
3
  class Minitest5 < Base
4
4
  def suites
5
- if Minitest.respond_to?(:seed)
6
- Minitest.seed = (ENV["SEED"] || srand).to_i % 0xFFFF
7
- end
5
+ Minitest.seed = (ENV["SEED"] || srand).to_i % 0xFFFF if Minitest.respond_to? :seed
8
6
  Minitest::Runnable.runnables
9
7
  end
10
8
 
11
- def run(test_arguments)
9
+ def run test_arguments
12
10
  output = Minitest.run test_arguments
13
11
  ::Minitest.class_variable_get(:@@after_run).reverse_each(&:call)
14
12
  output
15
13
  end
16
14
 
17
- def test_methods(suite_class)
15
+ def test_methods suite_class
18
16
  suite_class.runnable_methods
19
17
  end
20
18
  end
@@ -0,0 +1,3 @@
1
+ require_relative "minitest_5"
2
+
3
+ M::Runners::Minitest6 = M::Runners::Minitest5
@@ -2,22 +2,22 @@ module M
2
2
  module Runners
3
3
  class TestUnit < Base
4
4
  def suites
5
- if Test::Unit::TestCase.respond_to?(:test_suites)
5
+ if Test::Unit::TestCase.respond_to? :test_suites
6
6
  Test::Unit::TestCase.test_suites
7
7
  else
8
8
  Test::Unit::TestCase::DESCENDANTS
9
9
  end
10
10
  end
11
11
 
12
- def run(test_arguments)
13
- Test::Unit::AutoRunner.run(false, nil, test_arguments)
12
+ def run test_arguments
13
+ Test::Unit::AutoRunner.run false, nil, test_arguments
14
14
  end
15
15
 
16
- def test_methods(suite_class)
17
- if suite_class.respond_to?(:test_methods)
16
+ def test_methods suite_class
17
+ if suite_class.respond_to? :test_methods
18
18
  suite_class.test_methods
19
19
  else
20
- suite_class.public_instance_methods(true).grep(/^test/).map { |m| m.to_s }
20
+ suite_class.public_instance_methods(true).grep(/^test/).map(&:to_s)
21
21
  end
22
22
  end
23
23
  end
@@ -6,14 +6,14 @@ module M
6
6
  []
7
7
  end
8
8
 
9
- def run(_test_arguments)
9
+ def run _test_arguments
10
10
  not_supported
11
11
  end
12
12
 
13
13
  private
14
14
 
15
15
  def not_supported
16
- STDERR.puts "This test framework is not supported! Please open up an issue at https://github.com/qrush/m !"
16
+ warn "This test framework is not supported! Please open up an issue at https://github.com/qrush/m !"
17
17
  false
18
18
  end
19
19
  end
@@ -11,18 +11,18 @@ module M
11
11
  # internal collection
12
12
  def_delegators :@collection, :size, :<<, :each
13
13
 
14
- def initialize(collection = nil)
14
+ def initialize collection = nil
15
15
  @collection = collection || []
16
16
  end
17
17
 
18
18
  # Slice out tests that may be within the given line.
19
19
  # Returns a new TestCollection with the results.
20
- def within(lines)
20
+ def within lines
21
21
  # Into a new collection, filter only the tests that...
22
22
  collection = select do |test|
23
- lines.none? || lines.any? { |line| (test.start_line..test.end_line).include?(line) }
23
+ lines.none? || lines.any? { |line| (test.start_line..test.end_line).cover?(line) }
24
24
  end
25
- self.class.new(collection)
25
+ self.class.new collection
26
26
  end
27
27
 
28
28
  # Used to line up method names in `#sprintf` when `m` aborts
@@ -33,7 +33,7 @@ module M
33
33
  end
34
34
 
35
35
  # Be considerate when printing out tests and pre-sort them by line number
36
- def by_line_number(&block)
36
+ def by_line_number &block
37
37
  # On each member of the collection, sort by line number and yield
38
38
  # the block into the sorted collection
39
39
  sort_by(&:start_line).each(&block)
data/lib/m/test_method.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "method_source"
1
+ require_relative "finish_line" # if RUBY_VERSION < "4.1"
2
2
 
3
3
  module M
4
4
  ### Simple data structure for what a test method contains.
@@ -8,27 +8,22 @@ module M
8
8
  #
9
9
  # Includes the name of this method, what line on the file it begins on,
10
10
  # and where it ends.
11
- class TestMethod < Struct.new(:name, :start_line, :end_line)
12
- # Set up a new test method for this test suite class
13
- def self.create(suite_class, test_method)
14
- # Hopefully it's been defined as an instance method, so we'll need to
15
- # look up the ruby Method instance for it
16
- method = suite_class.instance_method(test_method)
11
+ TestMethod = Struct.new :name, :start_line, :end_line do
12
+ def self.create suite_class, test_method
13
+ method = suite_class.instance_method test_method
17
14
 
18
- # Ruby can find the starting line for us, so pull that out of the array
19
- start_line = method.source_location.last
15
+ # Ruby can find the starting line for us, so pull that out of the array.
16
+ # Ruby 4.1+ can also provide the ending line.
17
+ #start_line, end_line = method.source_location.values_at(1, 3)
18
+ start_line = method.source_location[1]
20
19
 
21
- # Ruby can't find the end line however, and I'm too lazy to write
22
- # a parser. Instead, `method_source` adds `Method#source` so we can
23
- # deduce this ourselves.
24
- #
25
- # The end line should be the number of line breaks in the method source,
26
- # added to the starting line and subtracted by one.
27
-
28
- end_line = method.source.split("\n").size + start_line - 1
20
+ # Ruby < 4.1 can't find the end line. Use a Ripper-derived parser to
21
+ # determine the ending line.
22
+ #end_line ||= FinishLine.ending_line_for method
23
+ end_line = FinishLine.ending_line_for method
29
24
 
30
25
  # Shove the given attributes into a new databag
31
- new(test_method, start_line, end_line)
26
+ new test_method, start_line, end_line
32
27
  end
33
28
  end
34
29
  end
data/lib/m/testable.rb CHANGED
@@ -3,14 +3,14 @@ module M
3
3
  attr_accessor :file, :recursive, :passthrough_options
4
4
  attr_reader :lines
5
5
 
6
- def initialize(file = "", lines = [], recursive = false)
6
+ def initialize file = "", lines = [], recursive = false
7
7
  @file = file
8
8
  @recursive = recursive
9
9
  @passthrough_options = []
10
10
  self.lines = lines
11
11
  end
12
12
 
13
- def lines=(lines)
13
+ def lines= lines
14
14
  @lines = lines.map(&:to_i)
15
15
  end
16
16
  end
data/lib/m/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module M
2
- VERSION = "1.6.1"
2
+ VERSION = "1.7.0".freeze
3
3
  end
data/lib/m.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  ### M, your metal test runner
2
2
  # Maybe this gem should have a longer name? Metal?
3
- require_relative 'm/version'
4
- require_relative 'm/frameworks'
5
- require_relative 'm/runner'
3
+ require_relative "m/version"
4
+ require_relative "m/frameworks"
5
+ require_relative "m/runner"
6
6
 
7
7
  module M
8
8
  # Accept arguments coming from bin/m and run tests, then bail out immediately.
9
- def self.run(argv)
9
+ def self.run argv
10
10
  # sync output since we're going to exit hard and fast
11
11
  $stdout.sync = true
12
12
  $stderr.sync = true
data/m.gemspec CHANGED
@@ -1,26 +1,24 @@
1
- require './lib/m'
1
+ require "./lib/m"
2
2
 
3
3
  Gem::Specification.new do |gem|
4
- gem.authors = ["Nick Quaranto"]
5
- gem.email = ["nick@quaran.to"]
6
- gem.homepage = "https://github.com/qrush/m"
4
+ gem.authors = ["Nick Quaranto"]
5
+ gem.email = ["nick@quaran.to"]
6
+ gem.homepage = "https://github.com/qrush/m"
7
+ gem.license = "MIT"
7
8
 
8
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
9
- gem.files = `git ls-files`.split("\n")
10
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
11
- gem.name = "m"
9
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
10
+ gem.files = `git ls-files`.split "\n"
11
+ gem.name = "m"
12
12
  gem.require_paths = ["lib"]
13
- gem.version = M::VERSION
13
+ gem.version = M::VERSION
14
14
 
15
- gem.add_runtime_dependency "method_source", ">= 0.6.7"
16
- gem.add_runtime_dependency "rake", ">= 0.9.2.2"
15
+ gem.add_runtime_dependency "rake"
17
16
 
18
17
  gem.add_development_dependency "activesupport"
19
- gem.add_development_dependency "rdiscount" unless defined? JRUBY_VERSION
20
- gem.add_development_dependency "rocco" unless defined? JRUBY_VERSION
21
- gem.add_development_dependency "appraisal"
18
+ gem.add_development_dependency "standard"
22
19
 
23
- gem.required_ruby_version = ">= 1.9"
20
+ gem.required_ruby_version = ">= 2.7"
24
21
 
25
- gem.summary = gem.description = %q{Run test/unit tests by line number. Metal!}
22
+ gem.summary = gem.description = "Run test/unit tests by line number. Metal!"
23
+ gem.metadata["rubygems_mfa_required"] = "true"
26
24
  end
data/test/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require "rake/testtask"
2
2
 
3
3
  Rake::TestTask.new do |t|
4
- t.libs << '.'
5
- t.pattern = 'examples/*_test.rb'
4
+ t.libs << "."
5
+ t.pattern = "examples/*_test.rb"
6
6
  end
@@ -1,53 +1,58 @@
1
- require 'test_helper'
1
+ require_relative "test_helper"
2
2
 
3
3
  class ActiveSupportTest < MTest
4
+ def test_run_simple_test_by_line_number_with_absolute_path
5
+ output = m File.join(__dir__, "examples/active_support_example_test.rb:9")
6
+ assert_output(/1 (runs|tests), 1 assertions/, output)
7
+ end
8
+
4
9
  def test_run_simple_test_by_line_number
5
- output = m('examples/active_support_example_test.rb:12')
10
+ output = m "examples/active_support_example_test.rb:9"
6
11
  assert_output(/1 (runs|tests), 1 assertions/, output)
7
12
  end
8
13
 
9
14
  def test_runs_entire_test_without_line_number
10
- output = m('examples/active_support_example_test.rb')
15
+ output = m "examples/active_support_example_test.rb"
11
16
  assert_output(/4 (runs|tests)/, output)
12
17
  end
13
18
 
14
19
  def test_run_inside_of_test
15
- output = m('examples/active_support_example_test.rb:13')
20
+ output = m "examples/active_support_example_test.rb:10"
16
21
  assert_output(/1 (runs|tests), 1 assertions/, output)
17
22
  end
18
23
 
19
24
  def test_run_on_end_of_test
20
- output = m('examples/active_support_example_test.rb:14')
25
+ output = m "examples/active_support_example_test.rb:11"
21
26
  assert_output(/1 (runs|tests), 1 assertions/, output)
22
27
  end
23
28
 
24
29
  def test_run_inside_big_test
25
- output = m('examples/active_support_example_test.rb:18')
30
+ output = m "examples/active_support_example_test.rb:15"
26
31
  assert_output(/1 (runs|tests), 3 assertions/, output)
27
32
  end
28
33
 
29
34
  def test_run_on_blank_line_orders_tests_by_line_number
30
- output = m('examples/active_support_example_test.rb:2')
35
+ output = m "examples/active_support_example_test.rb:8"
31
36
 
32
37
  assert !$?.success?
33
- expected = <<-EOF
34
- No tests found on line 2. Valid tests to run:
35
-
36
- test_normal: m examples/active_support_example_test.rb:8
37
- test_carrot: m examples/active_support_example_test.rb:12
38
- test_daikon: m examples/active_support_example_test.rb:16
39
- test_eggplant_fig: m examples/active_support_example_test.rb:22
40
- EOF
38
+ expected = <<~OUTPUT
39
+ No tests found on line 8. Valid tests to run:
40
+
41
+ test_normal: m examples/active_support_example_test.rb:5
42
+ test_carrot: m examples/active_support_example_test.rb:9
43
+ test_daikon: m examples/active_support_example_test.rb:13
44
+ test_eggplant_fig: m examples/active_support_example_test.rb:19
45
+ OUTPUT
41
46
  assert_equal expected.strip, output
42
47
  end
43
48
 
44
49
  def test_run_on_test_with_spaces
45
- output = m('examples/active_support_example_test.rb:22')
50
+ output = m "examples/active_support_example_test.rb:19"
46
51
  assert_output(/1 (runs|tests), 1 assertions/, output)
47
52
  end
48
53
 
49
54
  def test_run_on_test_with_unescaped_regular_express_characters
50
- output = m('examples/active_support_unescaped_example_test.rb:8')
55
+ output = m "examples/active_support_unescaped_example_test.rb:5"
51
56
  assert_output(/1 (runs|tests), 1 assertions/, output)
52
57
  end
53
58
  end
data/test/allocations.rb CHANGED
@@ -1,23 +1,20 @@
1
- $LOAD_PATH.unshift 'lib'
2
- require 'm'
3
- require 'allocation_stats'
1
+ require_relative "../lib/m"
2
+ require "allocation_stats"
4
3
 
5
- def benchmark_allocations(burn: 1)
6
- stats = AllocationStats.new(burn: burn).trace do
7
- yield
8
- end
4
+ def benchmark_allocations burn: 1, &block
5
+ stats = AllocationStats.new(burn: burn).trace(&block)
9
6
 
10
- columns = if ENV['DETAIL']
11
- [:sourcefile, :sourceline, :class_plus]
12
- else
13
- [:class_plus]
14
- end
7
+ columns = if ENV["DETAIL"]
8
+ [:sourcefile, :sourceline, :class_plus]
9
+ else
10
+ [:class_plus]
11
+ end
15
12
 
16
13
  puts stats.allocations(alias_paths: true).group_by(*columns).sort_by_size.to_text
17
14
  end
18
15
 
19
16
  benchmark_allocations do
20
17
  10.times do
21
- M::Runner.new(['test/examples/minitest_5_example_test.rb:19']).run
18
+ M::Runner.new(["test/examples/minitest_5_or_6_example_test.rb:19"]).run
22
19
  end
23
20
  end
data/test/bench.rb CHANGED
@@ -1,35 +1,28 @@
1
- require 'benchmark/ips'
1
+ require "benchmark/ips"
2
+ require "rbconfig"
2
3
 
3
4
  Benchmark.ips do |bench|
4
5
  bench.report("running m on a file that doesn't exist") do
5
- `ruby -Ilib ./bin/m failwhale 2>/dev/null`
6
+ `bundle exec #{RbConfig.ruby} -Ilib ./bin/m failwhale 2>/dev/null`
6
7
  end
7
8
 
8
9
  bench.report("running m on an empty file") do
9
- `ruby -Ilib ./bin/m test/examples/empty_example_test.rb 2>/dev/null`
10
+ `bundle exec #{RbConfig.ruby} -Ilib ./bin/m test/examples/empty_example_test.rb 2>/dev/null`
10
11
  end
11
12
 
12
- bench.report("running m on an entire file with minitest4") do
13
- `appraisal minitest4 ruby -Ilib ./bin/m test/examples/minitest_4_example_test.rb 2>/dev/null`
14
- end
15
-
16
- bench.report("running m on an entire file with minitest5") do
17
- `appraisal minitest5 ruby -Ilib ./bin/m test/examples/minitest_5_example_test.rb 2>/dev/null`
13
+ bench.report("running m on an entire file with minitest") do
14
+ `bundle exec #{RbConfig.ruby} -Ilib ./bin/m test/examples/minitest_5_or_6_example_test.rb 2>/dev/null`
18
15
  end
19
16
 
20
17
  bench.report("running m on an entire file with test-unit gem") do
21
- `appraisal test_unit_gem ruby -Ilib ./bin/m test/examples/test_unit_example_test.rb 2>/dev/null`
22
- end
23
-
24
- bench.report("running m on a specific test with minitest4") do
25
- `appraisal minitest4 ruby -Ilib ./bin/m test/examples/minitest_4_example_test.rb:19 2>/dev/null`
18
+ `bundle exec #{RbConfig.ruby} -Ilib ./bin/m test/examples/test_unit_example_test.rb 2>/dev/null`
26
19
  end
27
20
 
28
- bench.report("running m on a specific test with minitest5") do
29
- `appraisal minitest5 ruby -Ilib ./bin/m test/examples/minitest_5_example_test.rb:19 2>/dev/null`
21
+ bench.report("running m on a specific test with minitest") do
22
+ `bundle exec #{RbConfig.ruby} -Ilib ./bin/m test/examples/minitest_5_or_6_example_test.rb:19 2>/dev/null`
30
23
  end
31
24
 
32
25
  bench.report("running m on a specific test with test-unit gem") do
33
- `appraisal test_unit_gem ruby -Ilib ./bin/m test/examples/test_unit_example_test.rb:15 2>/dev/null`
26
+ `bundle exec #{RbConfig.ruby} -Ilib ./bin/m test/examples/test_unit_example_test.rb:15 2>/dev/null`
34
27
  end
35
28
  end
data/test/empty_test.rb CHANGED
@@ -1,8 +1,8 @@
1
- require 'test_helper'
1
+ require_relative "test_helper"
2
2
 
3
3
  class EmptyTest < MTest
4
4
  def test_run_simple_test_by_line_number
5
- output = m('examples/empty_example_test.rb')
5
+ output = m "examples/empty_example_test.rb"
6
6
  assert !$?.success?
7
7
  assert_match(/There were no tests found./, output)
8
8
  end
@@ -1,37 +1,33 @@
1
- require 'test_helper'
1
+ require_relative "test_helper"
2
2
 
3
3
  class EverythingTest < MTest
4
4
  def test_runs_entire_test_suite_with_no_arguments
5
- output = m('')
5
+ output = m ""
6
6
  assert_output(/12 (runs|tests)/, output)
7
7
  end
8
8
 
9
9
  def test_missing_file_gives_a_decent_error_message
10
- output = m('examples/thisdoesnexist_test.rb')
10
+ output = m "examples/thisdoesnexist_test.rb"
11
11
  assert !$?.success?
12
12
  assert_match(/Failed loading test file/, output)
13
- if defined? JRUBY_VERSION
14
- assert_match(/no such file to load/, output)
15
- else
16
- assert_match(/cannot load such file/, output)
17
- end
13
+ assert_match(/cannot load such file/, output)
18
14
  end
19
15
 
20
16
  def test_running_tests_within_a_subdirectory
21
- output = m('examples/subdir')
17
+ output = m "examples/subdir"
22
18
  assert_output(/3 (runs|tests)/, output)
23
19
 
24
- output = m('examples')
20
+ output = m "examples"
25
21
  assert_output(/12 (runs|tests)/, output)
26
22
  end
27
23
 
28
24
  def test_running_tests_with_failures_within_a_subdirectory
29
- output = m('examples/subdir_with_failures')
25
+ output = m "examples/subdir_with_failures"
30
26
  assert_output_for_failed_execution(/1 (runs|tests), 1 assertions, 1 failures/, output)
31
27
  end
32
28
 
33
29
  def test_blank_file_is_quieter
34
- output = m('bananas')
30
+ output = m "bananas"
35
31
  assert(/Valid tests to run/ !~ output)
36
32
  end
37
33
  end
@@ -1,10 +1,7 @@
1
- require 'active_support'
2
- require 'active_support/test_case'
1
+ require "active_support"
2
+ require "active_support/test_case"
3
3
 
4
4
  class ActiveSupportExampleTest < ActiveSupport::TestCase
5
- setup do
6
- end
7
-
8
5
  def test_normal
9
6
  assert_equal 1, 1
10
7
  end
@@ -1,10 +1,7 @@
1
- require 'active_support'
2
- require 'active_support/test_case'
1
+ require "active_support"
2
+ require "active_support/test_case"
3
3
 
4
4
  class ActiveSupportExampleTest < ActiveSupport::TestCase
5
- setup do
6
- end
7
-
8
5
  test "#assert_equal compares to objects (and ensures they are equal)" do
9
6
  assert_equal 1, 1
10
7
  end
@@ -1,4 +1,4 @@
1
- require_relative '../test_helper'
1
+ require_relative "../test_helper"
2
2
 
3
3
  class EmptyExampleTest < MTest
4
4
  end
@@ -1,6 +1,6 @@
1
- require 'minitest/autorun'
1
+ require "minitest/autorun"
2
2
 
3
- if M::Frameworks.minitest5?
3
+ if M::Frameworks.minitest5? || M::Frameworks.minitest6?
4
4
  class Meme
5
5
  def i_can_has_cheezburger?
6
6
  "OHAI!"
@@ -1,4 +1,4 @@
1
- require 'minitest/unit'
1
+ require "minitest"
2
2
 
3
3
  class Meme
4
4
  def i_can_has_cheezburger?
@@ -10,9 +10,7 @@ class Meme
10
10
  end
11
11
  end
12
12
 
13
- Test = M::Frameworks.minitest4? ? MiniTest::Unit::TestCase : Minitest::Test
14
-
15
- class TestMeme < Test
13
+ class TestMeme < Minitest::Test
16
14
  def setup
17
15
  @meme = Meme.new
18
16
  end
@@ -32,5 +30,5 @@ class TestMeme < Test
32
30
  assert_equal "OHAI!", @meme.i_can_has_cheezburger?
33
31
  end
34
32
 
35
- Minitest.after_run { p "ran after run block" } if Minitest.respond_to?(:after_run)
33
+ Minitest.after_run { p "ran after run block" } if Minitest.respond_to? :after_run
36
34
  end
@@ -1,8 +1,8 @@
1
- require 'active_support'
2
- require 'active_support/test_case'
1
+ require "active_support"
2
+ require "active_support/test_case"
3
3
 
4
4
  class MultipleExampleTest < ActiveSupport::TestCase
5
- %w(grape habanero iceplant).each do |fruit|
5
+ ["grape", "habanero", "iceplant"].each do |fruit|
6
6
  test "#{fruit} is a fruit" do
7
7
  assert_equal 1, 1
8
8
  end
@@ -1,4 +1,4 @@
1
- require_relative '../../test_helper'
1
+ require_relative "../../test_helper"
2
2
 
3
3
  class ATest < MTest
4
4
  def test_a
@@ -1,4 +1,4 @@
1
- require_relative '../../../test_helper'
1
+ require_relative "../../../test_helper"
2
2
 
3
3
  class DTest < MTest
4
4
  def test_d
@@ -1,4 +1,4 @@
1
- require_relative '../../../../test_helper'
1
+ require_relative "../../../../test_helper"
2
2
 
3
3
  class ETest < MTest
4
4
  def test_e
@@ -1,4 +1,4 @@
1
- require_relative '../../test_helper'
1
+ require_relative "../../test_helper"
2
2
 
3
3
  class BTest < MTest
4
4
  def test_b
@@ -1,4 +1,4 @@
1
- require_relative '../../test_helper'
1
+ require_relative "../../test_helper"
2
2
 
3
3
  class CTest < MTest
4
4
  def test_c
@@ -1,4 +1,4 @@
1
- require_relative '../../test_helper'
1
+ require_relative "../../test_helper"
2
2
 
3
3
  class ATest < MTest
4
4
  def test_a
@@ -1,5 +1,5 @@
1
- require_relative '../test_helper'
2
- try_loading('test-unit')
1
+ require_relative "../test_helper"
2
+ try_loading "test-unit"
3
3
 
4
4
  if M::Frameworks.test_unit?
5
5
  class TestUnitExampleTest < Test::Unit::TestCase