зеркало из https://github.com/github/ruby.git
Imported minitest 2.2.2 (r6281)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
172af01255
Коммит
9b3e7967ab
|
@ -27,9 +27,7 @@ Wed Jun 1 15:40:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
Wed Jun 1 14:07:57 2011 Ryan Davis <ryand-ruby@zenspider.com>
|
Wed Jun 1 14:07:57 2011 Ryan Davis <ryand-ruby@zenspider.com>
|
||||||
|
|
||||||
* lib/minitest/*: MOSTLY Imported minitest 2.2.1 (r6277)... One
|
* lib/minitest/*: Imported minitest 2.2.2 (r6281)
|
||||||
feature wouldn't run and I don't know how to fix it. I need
|
|
||||||
sora_h's help to get it running happy with test/unit.
|
|
||||||
* test/minitest/*: ditto
|
* test/minitest/*: ditto
|
||||||
|
|
||||||
Wed Jun 1 12:35:50 2011 Ryan Davis <ryand-ruby@zenspider.com>
|
Wed Jun 1 12:35:50 2011 Ryan Davis <ryand-ruby@zenspider.com>
|
||||||
|
|
|
@ -121,10 +121,11 @@ module MiniTest
|
||||||
|
|
||||||
Tempfile.open("expect") do |a|
|
Tempfile.open("expect") do |a|
|
||||||
a.puts expect
|
a.puts expect
|
||||||
a.rewind
|
a.flush
|
||||||
|
|
||||||
Tempfile.open("butwas") do |b|
|
Tempfile.open("butwas") do |b|
|
||||||
b.puts butwas
|
b.puts butwas
|
||||||
b.rewind
|
b.flush
|
||||||
|
|
||||||
result = `#{MiniTest::Assertions.diff} #{a.path} #{b.path}`
|
result = `#{MiniTest::Assertions.diff} #{a.path} #{b.path}`
|
||||||
result.sub!(/^\-\-\- .+/, "--- expected")
|
result.sub!(/^\-\-\- .+/, "--- expected")
|
||||||
|
@ -216,7 +217,7 @@ module MiniTest
|
||||||
# See also: MiniTest::Assertions.diff
|
# See also: MiniTest::Assertions.diff
|
||||||
|
|
||||||
def assert_equal exp, act, msg = nil
|
def assert_equal exp, act, msg = nil
|
||||||
msg = message(msg) { diff exp, act }
|
msg = message(msg, "") { diff exp, act }
|
||||||
assert(exp == act, msg)
|
assert(exp == act, msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -464,10 +465,10 @@ module MiniTest
|
||||||
##
|
##
|
||||||
# Returns a proc that will output +msg+ along with the default message.
|
# Returns a proc that will output +msg+ along with the default message.
|
||||||
|
|
||||||
def message msg = nil, &default
|
def message msg = nil, ending = ".", &default
|
||||||
proc {
|
proc {
|
||||||
custom_message = "#{msg}.\n" unless msg.nil? or msg.to_s.empty?
|
custom_message = "#{msg}.\n" unless msg.nil? or msg.to_s.empty?
|
||||||
"#{custom_message}#{default.call}."
|
"#{custom_message}#{default.call}#{ending}"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -619,7 +620,7 @@ module MiniTest
|
||||||
end
|
end
|
||||||
|
|
||||||
class Unit
|
class Unit
|
||||||
VERSION = "2.2.1" # :nodoc:
|
VERSION = "2.2.2" # :nodoc:
|
||||||
|
|
||||||
attr_accessor :report, :failures, :errors, :skips # :nodoc:
|
attr_accessor :report, :failures, :errors, :skips # :nodoc:
|
||||||
attr_accessor :test_count, :assertion_count # :nodoc:
|
attr_accessor :test_count, :assertion_count # :nodoc:
|
||||||
|
@ -690,6 +691,23 @@ module MiniTest
|
||||||
@@out = stream
|
@@out = stream
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Tells MiniTest::Unit to delegate to +runner+, an instance of a
|
||||||
|
# MiniTest::Unit subclass, when MiniTest::Unit#run is called.
|
||||||
|
|
||||||
|
def self.runner= runner
|
||||||
|
@@runner = runner
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Returns the MiniTest::Unit subclass instance that will be used
|
||||||
|
# to run the tests. A MiniTest::Unit instance is the default
|
||||||
|
# runner.
|
||||||
|
|
||||||
|
def self.runner
|
||||||
|
@@runner ||= self.new
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Return all plugins' run methods (methods that start with "run_").
|
# Return all plugins' run methods (methods that start with "run_").
|
||||||
|
|
||||||
|
@ -860,9 +878,16 @@ module MiniTest
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Top level driver, controls all output and filtering.
|
# Begins the full test run. Delegates to +runner+'s #_run method.
|
||||||
|
|
||||||
def run args = []
|
def run args = []
|
||||||
|
self.class.runner._run(args)
|
||||||
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Top level driver, controls all output and filtering.
|
||||||
|
|
||||||
|
def _run args = []
|
||||||
self.options = process_args args
|
self.options = process_args args
|
||||||
|
|
||||||
puts "Run options: #{help}"
|
puts "Run options: #{help}"
|
||||||
|
|
|
@ -595,6 +595,7 @@ module Test
|
||||||
yield self if block_given?
|
yield self if block_given?
|
||||||
files
|
files
|
||||||
end
|
end
|
||||||
|
Runner.runner = @runner
|
||||||
@options = @runner.option_parser
|
@options = @runner.option_parser
|
||||||
@argv = argv
|
@argv = argv
|
||||||
end
|
end
|
||||||
|
|
|
@ -51,7 +51,7 @@ Finished tests in 0.00
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
MiniTest::Unit.output = $stdout
|
MiniTest::Unit.output = $stdout
|
||||||
# HACK for ruby-trunk: MiniTest::Unit.runner = nil
|
MiniTest::Unit.runner = nil
|
||||||
Object.send :remove_const, :ATestCase if defined? ATestCase
|
Object.send :remove_const, :ATestCase if defined? ATestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -392,13 +392,10 @@ not yet
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_default_runner_is_minitest_unit
|
def test_default_runner_is_minitest_unit
|
||||||
skip "ruby-trunk won't run with runner code :("
|
|
||||||
|
|
||||||
assert_instance_of MiniTest::Unit, MiniTest::Unit.runner
|
assert_instance_of MiniTest::Unit, MiniTest::Unit.runner
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_run_with_other_runner
|
def test_run_with_other_runner
|
||||||
skip "ruby-trunk won't run with runner code :("
|
|
||||||
|
|
||||||
runner = Class.new(MiniTest::Unit) do
|
runner = Class.new(MiniTest::Unit) do
|
||||||
# Run once before each suite
|
# Run once before each suite
|
||||||
|
@ -542,7 +539,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
-#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"a\">
|
-#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"a\">
|
||||||
+#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"b\">
|
+#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"b\">
|
||||||
.".gsub(/^ +/, "")
|
".gsub(/^ +/, "")
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal o1, o2
|
@tc.assert_equal o1, o2
|
||||||
|
@ -555,7 +552,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
||||||
|
|
||||||
msg = "No visible difference.
|
msg = "No visible difference.
|
||||||
You should look at your implementation of Object#==.
|
You should look at your implementation of Object#==.
|
||||||
#<Object:0xXXXXXX>.".gsub(/^ +/, "")
|
#<Object:0xXXXXXX>".gsub(/^ +/, "")
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal o1, o2
|
@tc.assert_equal o1, o2
|
||||||
|
@ -568,7 +565,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
-\"hahahahahahahahahahahahahahahahahahahaha\"
|
-\"hahahahahahahahahahahahahahahahahahahaha\"
|
||||||
+\"blahblahblahblahblahblahblahblahblahblah\"
|
+\"blahblahblahblahblahblahblahblahblahblah\"
|
||||||
.".gsub(/^ +/, "")
|
".gsub(/^ +/, "")
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
o1 = "haha" * 10
|
o1 = "haha" * 10
|
||||||
|
@ -581,7 +578,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
||||||
def test_assert_equal_different_long_invisible
|
def test_assert_equal_different_long_invisible
|
||||||
msg = "No visible difference.
|
msg = "No visible difference.
|
||||||
You should look at your implementation of String#==.
|
You should look at your implementation of String#==.
|
||||||
\"blahblahblahblahblahblahblahblahblahblah\".".gsub(/^ +/, "")
|
\"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
o1 = "blah" * 10
|
o1 = "blah" * 10
|
||||||
|
@ -600,7 +597,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
||||||
@@ -1 +1 @@
|
@@ -1 +1 @@
|
||||||
-\"hahahahahahahahahahahahahahahahahahahaha\"
|
-\"hahahahahahahahahahahahahahahahahahahaha\"
|
||||||
+\"blahblahblahblahblahblahblahblahblahblah\"
|
+\"blahblahblahblahblahblahblahblahblahblah\"
|
||||||
.".gsub(/^ +/, "")
|
".gsub(/^ +/, "")
|
||||||
|
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
o1 = "haha" * 10
|
o1 = "haha" * 10
|
||||||
|
@ -622,7 +619,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_equal_different_short_multiline
|
def test_assert_equal_different_short_multiline
|
||||||
msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n."
|
msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n"
|
||||||
util_assert_triggered msg do
|
util_assert_triggered msg do
|
||||||
@tc.assert_equal "a\nb", "a\nc"
|
@tc.assert_equal "a\nb", "a\nc"
|
||||||
end
|
end
|
||||||
|
@ -1292,7 +1289,7 @@ FILE:LINE:in `test_assert_raises_triggered_subclass'
|
||||||
end
|
end
|
||||||
|
|
||||||
def util_msg exp, act, msg = nil
|
def util_msg exp, act, msg = nil
|
||||||
s = "Expected: #{exp.inspect}\n Actual: #{act.inspect}."
|
s = "Expected: #{exp.inspect}\n Actual: #{act.inspect}"
|
||||||
s = "#{msg}.\n#{s}" if msg
|
s = "#{msg}.\n#{s}" if msg
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче