summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-11 23:52:04 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-07-11 23:52:04 +0000
commit9696b3eb16acd9c90f32fd65e3ed95120d8e73c3 (patch)
treecdccb2458d619e3104a358f82d4ef09192d7de0b /lib
parent35784d10191308f39f694e8513cfc351d6712865 (diff)
Imported minitest 3.2.0 (r7598). Reviewed by drbrain
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/minitest/mock.rb15
-rw-r--r--lib/minitest/spec.rb8
-rw-r--r--lib/minitest/unit.rb12
3 files changed, 10 insertions, 25 deletions
diff --git a/lib/minitest/mock.rb b/lib/minitest/mock.rb
index ec36d775cc..38f15757eb 100644
--- a/lib/minitest/mock.rb
+++ b/lib/minitest/mock.rb
@@ -57,12 +57,12 @@ module MiniTest
self
end
- def call name, data
+ def __call name, data
case data
when Hash then
"#{name}(#{data[:args].inspect[1..-2]}) => #{data[:retval].inspect}"
else
- data.map { |d| call name, d }.join ", "
+ data.map { |d| __call name, d }.join ", "
end
end
@@ -74,15 +74,16 @@ module MiniTest
def verify
@expected_calls.each do |name, calls|
calls.each do |expected|
- msg1 = "expected #{call name, expected}"
- msg2 = "#{msg1}, got [#{call name, @actual_calls[name]}]"
+ msg1 = "expected #{__call name, expected}"
+ msg2 = "#{msg1}, got [#{__call name, @actual_calls[name]}]"
raise MockExpectationError, msg2 if
- @actual_calls.has_key? name and
+ @actual_calls.has_key?(name) and
not @actual_calls[name].include?(expected)
raise MockExpectationError, msg1 unless
- @actual_calls.has_key? name and @actual_calls[name].include?(expected)
+ @actual_calls.has_key?(name) and
+ @actual_calls[name].include?(expected)
end
end
true
@@ -163,7 +164,7 @@ class Object # :nodoc:
end
end
- yield
+ yield self
ensure
metaclass.send :undef_method, name
metaclass.send :alias_method, name, new_name
diff --git a/lib/minitest/spec.rb b/lib/minitest/spec.rb
index c0c0ae2f02..02c57ec7ef 100644
--- a/lib/minitest/spec.rb
+++ b/lib/minitest/spec.rb
@@ -181,12 +181,6 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
add_teardown_hook {|tc| tc.instance_eval(&block) }
end
- NAME_RE = if RUBY_VERSION >= "1.9"
- Regexp.new("[^[[:word:]]]+")
- else
- /\W+/u
- end
-
##
# Define an expectation with name +desc+. Name gets morphed to a
# proper test method name. For some freakish reason, people who
@@ -204,7 +198,7 @@ class MiniTest::Spec < MiniTest::Unit::TestCase
@specs ||= 0
@specs += 1
- name = "test_%04d_%s" % [ @specs, desc.gsub(NAME_RE, '_').downcase ]
+ name = "test_%04d_%s" % [ @specs, desc ]
define_method name, &block
diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb
index 50c1fac94b..1b95742af3 100644
--- a/lib/minitest/unit.rb
+++ b/lib/minitest/unit.rb
@@ -652,7 +652,7 @@ module MiniTest
end
class Unit # :nodoc:
- VERSION = "3.0.0" # :nodoc:
+ VERSION = "3.2.0" # :nodoc:
attr_accessor :report, :failures, :errors, :skips # :nodoc:
attr_accessor :test_count, :assertion_count # :nodoc:
@@ -714,16 +714,6 @@ module MiniTest
end
##
- # Returns the stream to use for output.
- #
- # DEPRECATED: use ::output instead.
-
- def self.out
- warn "::out deprecated, use ::output instead." if $VERBOSE
- output
- end
-
- ##
# Sets MiniTest::Unit to write output to +stream+. $stdout is the default
# output