diff options
| author | yui-knk <spiketeika@gmail.com> | 2024-01-01 10:17:08 +0900 |
|---|---|---|
| committer | Yuichiro Kaneko <spiketeika@gmail.com> | 2024-01-02 09:50:32 +0900 |
| commit | 6ec4d203f7aaf9737b78b9d90de7865004c900d8 (patch) | |
| tree | ca1f4df2721e111f67310575d70838284ed9bc8f /test/ruby | |
| parent | 9368782d5c96f08d61933e994789812e5e73260d (diff) | |
Warn "literal in condition" for `__LINE__`
Print warning for a code like
```ruby
if __LINE__
end
# => warning: literal in condition
```
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_syntax.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 286a820b02..5e277c8d8e 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1216,6 +1216,9 @@ eom assert_warning(/literal in condition/) do eval('1 if 1') end + assert_warning(/literal in condition/) do + eval('1 if __LINE__') + end assert_warning(/symbol literal in condition/) do eval('1 if :foo') end |
