Skip to content

Commit

Permalink
Merge pull request #1237 from ruby/ruby-32/regexp-new
Browse files Browse the repository at this point in the history
Fix Regexp.new
  • Loading branch information
soutaro committed Feb 16, 2023
2 parents 7bfd2b8 + 90e8f9a commit 06b8d45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/regexp.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ class Regexp
#
# Regexp.compile is an alias for Regexp.new.
#
def initialize: (String string, ?Integer | nil | false | top options, ?String kcode) -> Object
def initialize: (String string, ?String | Integer | nil | false options) -> Object
| (Regexp regexp) -> void

# <!--
Expand Down
8 changes: 4 additions & 4 deletions test/stdlib/Regexp_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ class RegexpTest < StdlibTest
def test_new
Regexp.new('dog')
Regexp.new('dog', option = Regexp::IGNORECASE)
Regexp.new('dog', option = nil, code = 'n')
Regexp.new('dog', option = Regexp::IGNORECASE, code = 'n')
Regexp.new('dog', option = nil)
Regexp.new('dog', option = Regexp::IGNORECASE)
Regexp.new(/^a-z+:\\s+\w+/)
end

def test_compile
Regexp.compile('dog')
Regexp.compile('dog', option = Regexp::IGNORECASE)
Regexp.compile('dog', option = nil, code = 'n')
Regexp.compile('dog', option = Regexp::IGNORECASE, code = 'n')
Regexp.compile('dog', option = nil)
Regexp.compile('dog', option = Regexp::IGNORECASE)
Regexp.compile(/^a-z+:\\s+\w+/)
end

Expand Down

0 comments on commit 06b8d45

Please sign in to comment.