diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-18 13:08:53 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-10-18 13:08:53 +0000 |
commit | 4a375f3ef518797bc8788abf0891655d79aa719c (patch) | |
tree | b1393f1c8e067173dbb97d1b5d0eba825010fbf2 /test | |
parent | c1c3d07332d32f0981d6019c3f851e51739f0eb2 (diff) | |
download | ruby-4a375f3ef518797bc8788abf0891655d79aa719c.tar.gz |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_parse.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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")}} |