From 4a375f3ef518797bc8788abf0891655d79aa719c Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 18 Oct 2017 13:08:53 +0000 Subject: 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 --- test/ruby/test_parse.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 769500a261..b9fa57f2c7 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -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")}} -- cgit v1.2.3