mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* parse.y (parser_tokadd_string): regexp engine doesn't need
terminators to be escaped. [ruby-core:40364][Bug #5484] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b212b84fc1
commit
68a16f9a2d
3 changed files with 17 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Sun Mar 4 23:21:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_tokadd_string): regexp engine doesn't need
|
||||
terminators to be escaped. [ruby-core:40364][Bug #5484]
|
||||
|
||||
Sat Mar 3 22:51:46 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* process.c (rb_run_exec_options_err): chdir at last to interpret
|
||||
|
|
4
parse.y
4
parse.y
|
@ -6514,6 +6514,10 @@ parser_tokadd_string(struct parser_params *parser,
|
|||
goto non_ascii;
|
||||
}
|
||||
if (func & STR_FUNC_REGEXP) {
|
||||
if (c == term) {
|
||||
tokadd(c);
|
||||
continue;
|
||||
}
|
||||
pushback(c);
|
||||
if ((c = tokadd_escape(&enc)) < 0)
|
||||
return -1;
|
||||
|
|
|
@ -155,7 +155,10 @@ class TestRegexp < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_source
|
||||
bug5484 = ']ruby-core:40364]'
|
||||
assert_equal('', //.source)
|
||||
assert_equal('\:', /\:/.source, bug5484)
|
||||
assert_equal(':', %r:\::.source, bug5484)
|
||||
end
|
||||
|
||||
def test_inspect
|
||||
|
@ -369,9 +372,11 @@ class TestRegexp < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_equal
|
||||
assert_equal(true, /abc/ == /abc/)
|
||||
assert_equal(false, /abc/ == /abc/m)
|
||||
assert_equal(false, /abc/ == /abd/)
|
||||
bug5484 = ']ruby-core:40364]'
|
||||
assert_equal(/abc/, /abc/)
|
||||
assert_not_equal(/abc/, /abc/m)
|
||||
assert_not_equal(/abc/, /abd/)
|
||||
assert_equal(/\/foo/, Regexp.new('/foo'), bug5484)
|
||||
end
|
||||
|
||||
def test_match
|
||||
|
|
Loading…
Add table
Reference in a new issue