Skip to content

Commit

Permalink
Change return type of lifecycle hooks in minitest to be void
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegeek committed Dec 20, 2023
1 parent ceb28c5 commit af26f04
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stdlib/minitest/0/minitest/test/lifecycle_hooks.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ module Minitest::Test::LifecycleHooks
# include MyMinitestPlugin
# end
#
def before_setup: () -> nil
def before_setup: () -> void

# <!--
# rdoc-file=lib/minitest/test.rb
# - setup()
# -->
# Runs before every test. Use this to set up before each test run.
#
def setup: () -> nil
def setup: () -> void

# <!--
# rdoc-file=lib/minitest/test.rb
Expand All @@ -58,7 +58,7 @@ module Minitest::Test::LifecycleHooks
#
# See #before_setup for an example.
#
def after_setup: () -> nil
def after_setup: () -> void

# <!--
# rdoc-file=lib/minitest/test.rb
Expand All @@ -69,15 +69,15 @@ module Minitest::Test::LifecycleHooks
#
# See #before_setup for an example.
#
def before_teardown: () -> nil
def before_teardown: () -> void

# <!--
# rdoc-file=lib/minitest/test.rb
# - teardown()
# -->
# Runs after every test. Use this to clean up after each test run.
#
def teardown: () -> nil
def teardown: () -> void

# <!--
# rdoc-file=lib/minitest/test.rb
Expand All @@ -88,5 +88,5 @@ module Minitest::Test::LifecycleHooks
#
# See #before_setup for an example.
#
def after_teardown: () -> nil
def after_teardown: () -> void
end
17 changes: 17 additions & 0 deletions test/stdlib/Minitest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,20 @@ def test_after_run
end
end

class MinitestTestLifecycleHooksTest < Test::Unit::TestCase
include TestHelper

library "minitest"
testing "Minitest::Test::LifecycleHooks"

class LifecycleSetup < Minitest::Test
def setup
@foo = 123
end
end

def test_setup_return_type_void
test = LifecycleSetup.new("setup")
assert_send_type "() -> void", test, :setup
end
end

0 comments on commit af26f04

Please sign in to comment.