diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-09 10:09:20 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-09 10:09:20 +0000 |
commit | c2a7a82a69792ca822f8d2f25e3497512c06f1ea (patch) | |
tree | 65d13d21e7881facc8da792ba9850af68a66f1e6 /test/ruby/test_parse.rb | |
parent | 9ea6f49b4a834977528d7e3b1895ab24b98f6424 (diff) |
merge revision(s) 58503: [Backport #13523]
node.h: sign-extend
* node.h (nd_line): should sign-extend. shifting `VALUE` extends
with zero bits if `sizeof(VALUE)` equals to `sizeof(int)`. the
zero bits are truncated if `sizeof(VALUE)` is bigger enough.
[ruby-core:80920] [Bug #13523]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_parse.rb')
-rw-r--r-- | test/ruby/test_parse.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index a06ebdf8ba..5181ee4f21 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -876,6 +876,16 @@ x = __ENCODING__ assert_warning(/#{a}/) {eval("#{a} = 1; /(?<#{a}>)/ =~ ''")} end + def test_negative_line_number + bug = '[ruby-core:80920] [Bug #13523]' + obj = Object.new + obj.instance_eval("def t(e = false);raise if e; __LINE__;end", "test", -100) + assert_equal(-100, obj.t, bug) + assert_equal(-100, obj.method(:t).source_location[1], bug) + e = assert_raise(RuntimeError) {obj.t(true)} + assert_equal(-100, e.backtrace_locations.first.lineno, bug) + end + =begin def test_past_scope_variable assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} |