summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-29 23:06:27 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-08-29 23:06:27 +0900
commit01b723ba6dd48a0954765e43cff6bd9212afe259 (patch)
treed19e0cc907d4b4b3f7caae8cba40438b395c3368 /test/ruby
parent79117d4a9b794fba68c3d7ac699ad8a989bd29dc (diff)
downloadruby-01b723ba6dd48a0954765e43cff6bd9212afe259.tar.gz
Refined warnings against literal in flip-flop
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb24
1 files changed, 21 insertions, 3 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 05e6de38f5..9b9063c768 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1007,9 +1007,6 @@ eom
assert_warn(/literal in condition/) do
eval('1 if //')
end
- assert_warn(/literal in condition/) do
- eval('1 if true..false')
- end
assert_warning(/literal in condition/) do
eval('1 if 1')
end
@@ -1040,6 +1037,27 @@ eom
end
end
+ def test_warning_literal_in_flip_flop
+ assert_warn(/literal in flip-flop/) do
+ eval('1 if ""..false')
+ end
+ assert_warning(/literal in flip-flop/) do
+ eval('1 if :foo..false')
+ end
+ assert_warning(/literal in flip-flop/) do
+ eval('1 if :"#{"foo".upcase}"..false')
+ end
+ assert_warn(/literal in flip-flop/) do
+ eval('1 if ""...false')
+ end
+ assert_warning(/literal in flip-flop/) do
+ eval('1 if :foo...false')
+ end
+ assert_warning(/literal in flip-flop/) do
+ eval('1 if :"#{"foo".upcase}"...false')
+ end
+ end
+
def test_alias_symbol
bug8851 = '[ruby-dev:47681] [Bug #8851]'
formats = ['%s', ":'%s'", ':"%s"', '%%s(%s)']