mirror of
https://github.com/ruby/ruby.git
synced 2025-08-27 23:16:42 +02:00
parse.y: serial comparisons
* parse.y (rel_expr): warn sequence of comparisons, which would be probably unintentional. [EXPERIMENTAL] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c1c3d07332
commit
4a375f3ef5
2 changed files with 23 additions and 5 deletions
|
@ -1069,6 +1069,14 @@ x = __ENCODING__
|
|||
assert_equal(1.3, o.x)
|
||||
end
|
||||
|
||||
def test_serial_comparison
|
||||
assert_warning(/comparison '<' after/) do
|
||||
$VERBOSE = true
|
||||
x = 1
|
||||
eval("if false; 0 < x < 2; end")
|
||||
end
|
||||
end
|
||||
|
||||
=begin
|
||||
def test_past_scope_variable
|
||||
assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue