Skip to content

Commit 91db4d8

Browse files
committed
First pass at Minitest 6
! Deleted MiniTest and MiniTest::Unit::TestCase compatibility namespaces. ! Deleted all use of Marshal for serialization. ! Deleted maglev? and rubinius? guard methods. ! assert_equal(nil, value) no longer allowed. Use assert_nil to be explicit. ! Deleted all minitest/spec expectations from Object. Use _/value/expect. ! Removed assert_send. + Added dependency on path_expander. + Added --rake and --binstub flags. + Assertions reuse themselves a lot more. Bumps assertion count in some places. + assert_operator and assert_predicate both call assert_respond_to first. + Ditto with their refute equivalents. + if message is passed a proc then that proc overrides all other output. TODO: Finish writing tests for some benchmark methods and reactivate them. Decide on final stub behavior. Rename test_order to run_order?
1 parent e6bc448 commit 91db4d8

19 files changed

+654
-729
lines changed

Manifest.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,24 @@ History.rdoc
33
Manifest.txt
44
README.rdoc
55
Rakefile
6+
bin/minitest
67
design_rationale.rb
78
lib/hoe/minitest.rb
89
lib/minitest.rb
910
lib/minitest/assertions.rb
1011
lib/minitest/autorun.rb
1112
lib/minitest/benchmark.rb
13+
lib/minitest/complete.rb
1214
lib/minitest/expectations.rb
1315
lib/minitest/hell.rb
1416
lib/minitest/mock.rb
1517
lib/minitest/parallel.rb
1618
lib/minitest/pride.rb
1719
lib/minitest/pride_plugin.rb
1820
lib/minitest/spec.rb
21+
lib/minitest/sprint.rb
22+
lib/minitest/sprint_plugin.rb
1923
lib/minitest/test.rb
20-
lib/minitest/unit.rb
2124
test/minitest/metametameta.rb
2225
test/minitest/test_minitest_benchmark.rb
2326
test/minitest/test_minitest_mock.rb

Rakefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@ require "hoe"
66
Hoe.plugin :seattlerb
77
Hoe.plugin :rdoc
88

9+
Hoe.add_include_dirs "../../path_expander/dev/lib"
10+
911
Hoe.spec "minitest" do
1012
developer "Ryan Davis", "[email protected]"
1113

1214
license "MIT"
1315

16+
dependency "path_expander", "~> 1.0"
17+
1418
## TODO: uncomment this on the last point release on 5.x
1519
#
1620
# self.post_install_message = <<-"EOM"

bin/minitest

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/ruby
2+
3+
$LOAD_PATH.unshift "/Users/ryan/Work/p4/zss/src/path_expander/dev/lib"
4+
$LOAD_PATH.unshift "test"
5+
$LOAD_PATH.unshift "lib"
6+
7+
require "minitest/autorun"
8+
require "minitest/sprint"
9+
10+
Minitest::Sprint::PathExpander.new.process.each do |f|
11+
require "./#{f}"
12+
end

lib/minitest.rb

Lines changed: 5 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require "optparse"
2-
require "thread"
32
require "mutex_m"
43
require "minitest/parallel"
54
require "stringio"
@@ -8,8 +7,7 @@
87
# :include: README.rdoc
98

109
module Minitest
11-
VERSION = "5.11.3" # :nodoc:
12-
ENCS = "".respond_to? :encoding # :nodoc:
10+
VERSION = "6.0.0.a1" # :nodoc:
1311

1412
@@installed_at_exit ||= false
1513
@@after_run = []
@@ -87,8 +85,6 @@ def self.load_plugins # :nodoc:
8785

8886
seen = {}
8987

90-
require "rubygems" unless defined? Gem
91-
9288
Gem.find_files("minitest/*_plugin.rb").each do |plugin_path|
9389
name = File.basename plugin_path, "_plugin.rb"
9490

@@ -187,7 +183,7 @@ def self.process_args args = [] # :nodoc:
187183
end
188184

189185
opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
190-
options[:filter] = a
186+
options[:filter] = a # TODO: rename include?
191187
end
192188

193189
opts.on "-e", "--exclude PATTERN", "Exclude /regexp/ or string from run." do |a|
@@ -377,22 +373,6 @@ def self.runnables
377373
@@runnables
378374
end
379375

380-
@@marshal_dump_warned = false
381-
382-
def marshal_dump # :nodoc:
383-
unless @@marshal_dump_warned then
384-
warn ["Minitest::Runnable#marshal_dump is deprecated.",
385-
"You might be violating internals. From", caller.first].join " "
386-
@@marshal_dump_warned = true
387-
end
388-
389-
[self.name, self.failures, self.assertions, self.time]
390-
end
391-
392-
def marshal_load ary # :nodoc:
393-
self.name, self.failures, self.assertions, self.time = ary
394-
end
395-
396376
def failure # :nodoc:
397377
self.failures.first
398378
end
@@ -434,7 +414,7 @@ def result_code
434414
def skipped?
435415
raise NotImplementedError, "subclass responsibility"
436416
end
437-
end
417+
end # Runnable
438418

439419
##
440420
# Shared code for anything that can get passed to a Reporter. See
@@ -496,9 +476,6 @@ def error?
496476
class Result < Runnable
497477
include Minitest::Reportable
498478

499-
undef_method :marshal_dump
500-
undef_method :marshal_load
501-
502479
##
503480
# The class name of the test result.
504481

@@ -736,7 +713,7 @@ def aggregated_results io # :nodoc:
736713
end
737714

738715
def to_s # :nodoc:
739-
aggregated_results(StringIO.new(binary_string)).string
716+
aggregated_results(StringIO.new(''.b)).string
740717
end
741718

742719
def summary # :nodoc:
@@ -748,14 +725,6 @@ def summary # :nodoc:
748725
"%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
749726
[count, assertions, failures, errors, skips, extra]
750727
end
751-
752-
private
753-
754-
if '<3'.respond_to? :b
755-
def binary_string; ''.b; end
756-
else
757-
def binary_string; ''.force_encoding(Encoding::ASCII_8BIT); end
758-
end
759728
end
760729

761730
##
@@ -793,8 +762,7 @@ def start # :nodoc:
793762

794763
def prerecord klass, name # :nodoc:
795764
self.reporters.each do |reporter|
796-
# TODO: remove conditional for minitest 6
797-
reporter.prerecord klass, name if reporter.respond_to? :prerecord
765+
reporter.prerecord klass, name
798766
end
799767
end
800768

@@ -900,27 +868,13 @@ def jruby? platform = RUBY_PLATFORM
900868
"java" == platform
901869
end
902870

903-
##
904-
# Is this running on maglev?
905-
906-
def maglev? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
907-
"maglev" == platform
908-
end
909-
910871
##
911872
# Is this running on mri?
912873

913874
def mri? platform = RUBY_DESCRIPTION
914875
/^ruby/ =~ platform
915876
end
916877

917-
##
918-
# Is this running on rubinius?
919-
920-
def rubinius? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
921-
"rbx" == platform
922-
end
923-
924878
##
925879
# Is this running on windows?
926880

0 commit comments

Comments
 (0)