aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-05-24 16:51:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-06-20 19:35:12 +0900
commitab2a43265cfdda288d1baaa29936fd408c2a42bc (patch)
treef70d3b5b1c9ddb1c8a259642f9ede21a25afc173 /test/ruby/test_regexp.rb
parenta58611dfb1bfc74fb1a51a9cd0ca8ac690c2f1f4 (diff)
downloadruby-ab2a43265cfdda288d1baaa29936fd408c2a42bc.tar.gz
Warn suspicious flag to `Regexp.new`
Now second argument should be `true`, `false`, `nil` or Integer. This flag is confused with third argument some times.
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r--test/ruby/test_regexp.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 71d56ad027..5ee6b1b03c 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -628,6 +628,12 @@ class TestRegexp < Test::Unit::TestCase
assert_raise(RegexpError) { Regexp.new("((?<v>))\\g<0>") }
end
+ def test_initialize_bool_warning
+ assert_warning(/expected true or false as ignorecase/) do
+ Regexp.new("foo", :i)
+ end
+ end
+
def test_match_control_meta_escape
assert_equal(0, /\c\xFF/ =~ "\c\xFF")
assert_equal(0, /\c\M-\xFF/ =~ "\c\M-\xFF")