Skip to content

Commit

Permalink
Ensure that interrupt tests actually test correctness.
Browse files Browse the repository at this point in the history
If there's no exception raised, then the assertions won't actually run,
so we need to ensure that they do at all times.
  • Loading branch information
dark-panda committed Sep 9, 2015
1 parent 6aca48a commit 340c275
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/interrupt_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def test_interrupt_with_method
begin
buffer = geom.buffer(1, 8)
rescue => e
# no-op
ensure
assert_match(/^InterruptedException/, e.message)
assert_nil(buffer)
assert_interrupt_called
Expand All @@ -62,6 +64,8 @@ def test_interrupt_with_block
begin
buffer = geom.buffer(1, 8)
rescue => e
# no-op
ensure
assert_match(/^InterruptedException/, e.message)
assert_nil(buffer)
assert_interrupt_called
Expand All @@ -85,6 +89,8 @@ def test_interrupt_with_proc
begin
buffer = geom.buffer(1, 8)
rescue => e
# no-op
ensure
assert_match(/^InterruptedException/, e.message)
assert_nil(buffer)
assert_interrupt_called
Expand Down Expand Up @@ -118,6 +124,8 @@ def test_chain_interrupts
begin
buffer = geom.buffer(1, 8)
rescue => e
# no-op
ensure
assert_match(/^InterruptedException/, e.message)
assert_nil(buffer)
assert_interrupt_called(1)
Expand Down

0 comments on commit 340c275

Please sign in to comment.