aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_parse.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-29 02:58:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-29 02:58:53 +0000
commit7c174bcf4dda52a89349b45e030738057d6b554d (patch)
tree76e2953e54ba10bcda55adc6a8349c5ff64175aa /test/ruby/test_parse.rb
parent2fe086c60d508c28ca59dc6b28027975d5e447bf (diff)
downloadruby-7c174bcf4dda52a89349b45e030738057d6b554d.tar.gz
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/trunk@58503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_parse.rb')
-rw-r--r--test/ruby/test_parse.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 09cb0cf2a5..56e1020c5a 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -978,6 +978,16 @@ x = __ENCODING__
assert_equal(line, obj.location.lineno, bug)
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")}}