aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2024-01-01 10:24:25 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2024-01-02 09:50:32 +0900
commit5993d0f5f2e792b354955ae70442e66f7b31fb78 (patch)
tree9652eb364baa94b93142b10212cde2454923f77c
parent6ec4d203f7aaf9737b78b9d90de7865004c900d8 (diff)
downloadruby-5993d0f5f2e792b354955ae70442e66f7b31fb78.tar.gz
Add a test case for `__LINE__` assignment in condition warning
-rw-r--r--test/ruby/test_rubyoptions.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb
index 38ca119a8f..99af480f35 100644
--- a/test/ruby/test_rubyoptions.rb
+++ b/test/ruby/test_rubyoptions.rb
@@ -578,6 +578,15 @@ class TestRubyOptions < Test::Unit::TestCase
feature4299 = '[ruby-dev:43083]'
assert_in_out_err(["-w", t.path], "", [], err, feature4299)
assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err, feature4299)
+
+ t.rewind
+ t.truncate(0)
+ t.puts "if a = __LINE__; end"
+ t.flush
+ err = ["#{t.path}:1:#{warning}",
+ ]
+ assert_in_out_err(["-w", t.path], "", [], err)
+ assert_in_out_err(["-wr", t.path, "-e", ""], "", [], err)
}
end