summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-26 10:00:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-12-26 10:00:34 +0000
commitbb7b5a063129c344dbe3e52be055bdbbf160cdc8 (patch)
tree5d40675cddaa49214ff546aab0984af7c0b4ad5b /test
parent88d667ee444948b8c3bccafaadc653da0a319146 (diff)
test/ruby/test_symbol.rb: use begin;end; hack
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_symbol.rb27
1 files changed, 18 insertions, 9 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index 4461e51d61..4a7ca700c9 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -121,21 +121,24 @@ class TestSymbol < Test::Unit::TestCase
end
def test_to_proc_yield
- assert_ruby_status([], <<-"end;", timeout: 5.0)
+ assert_ruby_status([], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 5.0)
+ begin;
GC.stress = true
true.tap(&:itself)
end;
end
def test_to_proc_new_proc
- assert_ruby_status([], <<-"end;", timeout: 5.0)
+ assert_ruby_status([], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 5.0)
+ begin;
GC.stress = true
2.times {Proc.new(&:itself)}
end;
end
def test_to_proc_no_method
- assert_separately([], <<-"end;", timeout: 5.0)
+ assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 5.0)
+ begin;
bug11566 = '[ruby-core:70980] [Bug #11566]'
assert_raise(NoMethodError, bug11566) {Proc.new(&:foo).(1)}
assert_raise(NoMethodError, bug11566) {:foo.to_proc.(1)}
@@ -143,7 +146,8 @@ class TestSymbol < Test::Unit::TestCase
end
def test_to_proc_arg
- assert_separately([], <<-"end;", timeout: 5.0)
+ assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 5.0)
+ begin;
def (obj = Object.new).proc(&b) b; end
assert_same(:itself.to_proc, obj.proc(&:itself))
end;
@@ -168,13 +172,15 @@ class TestSymbol < Test::Unit::TestCase
def test_to_proc_for_hash_each
bug11830 = '[ruby-core:72205] [Bug #11830]'
- assert_normal_exit(<<-'end;', bug11830) # do
+ assert_normal_exit("#{<<-"begin;"}\n#{<<-'end;'}", bug11830)
+ begin;
{}.each(&:destroy)
end;
end
def test_to_proc_iseq
- assert_separately([], <<~"end;", timeout: 5) # do
+ assert_separately([], "#{<<-"begin;"}\n#{<<~"end;"}", timeout: 5)
+ begin;
bug11845 = '[ruby-core:72381] [Bug #11845]'
assert_nil(:class.to_proc.source_location, bug11845)
assert_equal([[:rest]], :class.to_proc.parameters, bug11845)
@@ -186,7 +192,8 @@ class TestSymbol < Test::Unit::TestCase
end
def test_to_proc_binding
- assert_separately([], <<~"end;", timeout: 5) # do
+ assert_separately([], "#{<<-"begin;"}\n#{<<~"end;"}", timeout: 5)
+ begin;
bug12137 = '[ruby-core:74100] [Bug #12137]'
assert_raise(ArgumentError, bug12137) {
:succ.to_proc.binding
@@ -454,13 +461,15 @@ class TestSymbol < Test::Unit::TestCase
def test_symbol_fstr_leak
bug10686 = '[ruby-core:67268] [Bug #10686]'
x = x = 0
- assert_no_memory_leak([], '200_000.times { |i| i.to_s.to_sym }; GC.start', <<-"end;", bug10686, limit: 1.71, rss: true, timeout: 20)
+ assert_no_memory_leak([], '200_000.times { |i| i.to_s.to_sym }; GC.start', "#{<<-"begin;"}\n#{<<-"end;"}", bug10686, limit: 1.71, rss: true, timeout: 20)
+ begin;
200_000.times { |i| (i + 200_000).to_s.to_sym }
end;
end
def test_hash_redefinition
- assert_separately([], <<-'end;')
+ assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}")
+ begin;
bug11035 = '[ruby-core:68767] [Bug #11035]'
class Symbol
def hash