Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

! Removed the long deprecated assert_block

! Removed the long deprecated lifecycle hooks: add_(setup|teardown)_hook
! Removed ::reset_setup_teardown_hooks

[git-p4: depot-paths = "//src/minitest/dev/": change = 8177]
  • Loading branch information...
commit 5bf2cfc35d8d5152c31d3d54a3d5b2bf303cac1d 1 parent 120e8c9
@zenspider zenspider authored
Showing with 1 addition and 138 deletions.
  1. +0 −96 lib/minitest/unit.rb
  2. +1 −42 test/minitest/test_minitest_unit.rb
View
96 lib/minitest/unit.rb
@@ -198,18 +198,6 @@ def assert test, msg = nil
end
##
- # Fails unless the block returns a true value.
- #
- # NOTE: This method is deprecated, use assert. It will be removed
- # on 2013-01-01."
-
- def assert_block msg = nil
- warn "NOTE: MiniTest::Unit::TestCase#assert_block is deprecated, use assert. It will be removed on 2013-01-01. Called from #{caller.first}"
- msg = message(msg) { "Expected block to return true value" }
- assert yield, msg
- end
-
- ##
# Fails unless +obj+ is empty.
def assert_empty obj, msg = nil
@@ -1206,79 +1194,6 @@ def before_teardown; end
def after_teardown; end
end
- module Deprecated # :nodoc:
-
- ##
- # This entire module is deprecated and slated for removal on 2013-01-01.
-
- module Hooks
- def run_setup_hooks # :nodoc:
- _run_hooks self.class.setup_hooks
- end
-
- def _run_hooks hooks # :nodoc:
- hooks.each do |hook|
- if hook.respond_to?(:arity) && hook.arity == 1
- hook.call(self)
- else
- hook.call
- end
- end
- end
-
- def run_teardown_hooks # :nodoc:
- _run_hooks self.class.teardown_hooks.reverse
- end
- end
-
- ##
- # This entire module is deprecated and slated for removal on 2013-01-01.
-
- module HooksCM
- ##
- # Adds a block of code that will be executed before every
- # TestCase is run.
- #
- # NOTE: This method is deprecated, use before/after_setup. It
- # will be removed on 2013-01-01.
-
- def add_setup_hook arg=nil, &block
- warn "NOTE: MiniTest::Unit::TestCase.add_setup_hook is deprecated, use before/after_setup via a module (and call super!). It will be removed on 2013-01-01. Called from #{caller.first}"
- hook = arg || block
- @setup_hooks << hook
- end
-
- def setup_hooks # :nodoc:
- if superclass.respond_to? :setup_hooks then
- superclass.setup_hooks
- else
- []
- end + @setup_hooks
- end
-
- ##
- # Adds a block of code that will be executed after every
- # TestCase is run.
- #
- # NOTE: This method is deprecated, use before/after_teardown. It
- # will be removed on 2013-01-01.
-
- def add_teardown_hook arg=nil, &block
- warn "NOTE: MiniTest::Unit::TestCase#add_teardown_hook is deprecated, use before/after_teardown. It will be removed on 2013-01-01. Called from #{caller.first}"
- hook = arg || block
- @teardown_hooks << hook
- end
-
- def teardown_hooks # :nodoc:
- if superclass.respond_to? :teardown_hooks then
- superclass.teardown_hooks
- else
- []
- end + @teardown_hooks
- end
- end
- end
-
##
# Subclass TestCase to create your own tests. Typically you'll want a
# TestCase subclass per implementation class.
@@ -1287,8 +1202,6 @@ def teardown_hooks # :nodoc:
class TestCase
include LifecycleHooks
- include Deprecated::Hooks
- extend Deprecated::HooksCM # UGH... I can't wait 'til 2013!
include Guard
extend Guard
@@ -1426,7 +1339,6 @@ class << self
def self.inherited klass # :nodoc:
@@test_suites[klass] = true
- klass.reset_setup_teardown_hooks
super
end
@@ -1474,14 +1386,6 @@ def setup; end
def teardown; end
- def self.reset_setup_teardown_hooks # :nodoc:
- # also deprecated... believe it.
- @setup_hooks = []
- @teardown_hooks = []
- end
-
- reset_setup_teardown_hooks
-
include MiniTest::Assertions
end # class TestCase
end # class Unit
View
43 test/minitest/test_minitest_unit.rb
@@ -17,23 +17,6 @@ class TestMiniTestUnit < MetaMetaMetaTestCase
"#{MINITEST_BASE_DIR}/test.rb:139:in `run'",
"#{MINITEST_BASE_DIR}/test.rb:106:in `run'"]
- def test_wtf
- $hook_value = nil
-
- capture_io do # don't care about deprecation
- MiniTest::Unit::TestCase.add_setup_hook do
- $hook_value = 42
- end
- end
-
- run_setup_hooks
-
- assert_equal 42, $hook_value
- assert_equal [Proc], MiniTest::Unit::TestCase.setup_hooks.map(&:class)
- MiniTest::Unit::TestCase.reset_setup_teardown_hooks
- assert_equal [], MiniTest::Unit::TestCase.setup_hooks.map(&:class)
- end
-
def test_class_puke_with_assertion_failed
exception = MiniTest::Assertion.new "Oh no!"
exception.set_backtrace ["unhappy"]
@@ -781,30 +764,6 @@ def test_assert__triggered_message
end
end
- def test_assert_block
- exp = ["NOTE: MiniTest::Unit::TestCase#assert_block is deprecated,",
- "use assert. It will be removed on 2013-01-01."].join " "
-
- out, err = capture_io do
- @tc.assert_block do
- true
- end
- end
-
- assert_equal "", out
- assert_match exp, err
- end
-
- def test_assert_block_triggered
- assert_output do
- util_assert_triggered "blah.\nExpected block to return true value." do
- @tc.assert_block "blah" do
- false
- end
- end
- end
- end
-
def test_assert_empty
@assertion_count = 2
@@ -1431,7 +1390,7 @@ def test_class_asserts_match_refutes
# These don't have corresponding refutes _on purpose_. They're
# useless and will never be added, so don't bother.
- ignores = %w[assert_block assert_output assert_raises assert_send
+ ignores = %w[assert_output assert_raises assert_send
assert_silent assert_throws]
# These are test/unit methods. I'm not actually sure why they're still here

3 comments on commit 5bf2cfc

@phiggins
Collaborator

Good night, sweet prince.

Please sign in to comment.
Something went wrong with that request. Please try again.