mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_eval.rb (class TestEval): Add test for shared eval
filenames via rb_fstring(). * test/ruby/test_iseq.rb (class TestISeq): Add test for shared iseq labels via rb_fstring(). [Bug #9159] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0c3b3e9237
commit
fdcc476e21
3 changed files with 29 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
Wed Nov 27 14:37:33 2013 Aman Gupta <ruby@tmm1.net>
|
||||
|
||||
* test/ruby/test_eval.rb (class TestEval): Add test for shared eval
|
||||
filenames via rb_fstring().
|
||||
* test/ruby/test_iseq.rb (class TestISeq): Add test for shared
|
||||
iseq labels via rb_fstring(). [Bug #9159]
|
||||
|
||||
Wed Nov 27 14:24:55 2013 Aman Gupta <ruby@tmm1.net>
|
||||
|
||||
* hash.c (hash_aset_str): Use rb_fstring() to de-duplicate hash string
|
||||
|
|
|
@ -473,4 +473,16 @@ class TestEval < Test::Unit::TestCase
|
|||
fname = "\u{3042}".encode("euc-jp")
|
||||
assert_equal(fname, eval("__FILE__", nil, fname, 1))
|
||||
end
|
||||
|
||||
def test_eval_location_fstring
|
||||
o = Object.new
|
||||
o.instance_eval "def foo() end", "generated code"
|
||||
o.instance_eval "def bar() end", "generated code"
|
||||
|
||||
a, b = o.method(:foo).source_location[0],
|
||||
o.method(:bar).source_location[0]
|
||||
|
||||
assert_equal a.object_id, b.object_id,
|
||||
"#{a.inspect}.object_id != #{b.inspect}.object_id"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -116,4 +116,14 @@ class TestISeq < Test::Unit::TestCase
|
|||
assert_equal("block in test_location", iseq.label)
|
||||
assert_equal(line+1, iseq.first_lineno)
|
||||
end
|
||||
|
||||
def test_label_fstring
|
||||
c = Class.new{ def foobar() end }
|
||||
|
||||
a, b = eval("# encoding: us-ascii\n'foobar'.freeze"),
|
||||
ISeq.of(c.instance_method(:foobar)).label
|
||||
|
||||
assert_equal a.object_id, b.object_id,
|
||||
"#{a.inspect}.object_id != #{b.inspect}.object_id"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue