mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
Reset $. before matching
This is a global variable and may happen to be set to 4 elsewhere. http://ci.rvm.jp/logfiles/brlog.trunk.20240403-054356#L1707 ``` The if expression with a boolean range ('flip-flop' operator) warns when Integer literals are used instead of predicates FAILED Expected [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [] to be truthy but was false ```
This commit is contained in:
parent
56ecd8038a
commit
ce395d7e90
@ -309,6 +309,7 @@ describe "The if expression" do
|
||||
it "warns when Integer literals are used instead of predicates" do
|
||||
-> {
|
||||
eval <<~RUBY
|
||||
$. = 0
|
||||
10.times { |i| ScratchPad << i if 4..5 }
|
||||
RUBY
|
||||
}.should complain(/warning: integer literal in flip-flop/, verbose: true)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user