Unverified Commit 17974aa2 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4978 from dearblue/test-ensure

Integrate class `EnsureYieldBreak` under test
parents 0a7fd86d 81c83521
## ##
# ensure Test # ensure Test
assert('ensure - context - yield') do class EnsureYieldBreak
class EnsureYieldBreak
attr_reader :ensure_context attr_reader :ensure_context
def try def try
yield yield
ensure ensure
@ensure_context = self @ensure_context = self
end end
end end
assert('ensure - context - yield') do
yielder = EnsureYieldBreak.new yielder = EnsureYieldBreak.new
yielder.try do yielder.try do
end end
...@@ -18,15 +18,6 @@ assert('ensure - context - yield') do ...@@ -18,15 +18,6 @@ assert('ensure - context - yield') do
end end
assert('ensure - context - yield and break') do assert('ensure - context - yield and break') do
class EnsureYieldBreak
attr_reader :ensure_context
def try
yield
ensure
@ensure_context = self
end
end
yielder = EnsureYieldBreak.new yielder = EnsureYieldBreak.new
yielder.try do yielder.try do
break break
...@@ -35,15 +26,6 @@ assert('ensure - context - yield and break') do ...@@ -35,15 +26,6 @@ assert('ensure - context - yield and break') do
end end
assert('ensure - context - yield and return') do assert('ensure - context - yield and return') do
class EnsureYieldBreak
attr_reader :ensure_context
def try
yield
ensure
@ensure_context = self
end
end
yielder = EnsureYieldBreak.new yielder = EnsureYieldBreak.new
lambda do lambda do
yielder.try do yielder.try do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment