mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
more tests for embedding regexps.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ec4756f633
commit
bf88192354
1 changed files with 36 additions and 0 deletions
|
@ -450,6 +450,42 @@ class TestM17N < Test::Unit::TestCase
|
||||||
|
|
||||||
r = /\xc2\xa1/e
|
r = /\xc2\xa1/e
|
||||||
assert_raise(ArgumentError) { /\xc2\xa1#{r}/s }
|
assert_raise(ArgumentError) { /\xc2\xa1#{r}/s }
|
||||||
|
|
||||||
|
r1 = Regexp.new('foo'.force_encoding("ascii-8bit"))
|
||||||
|
r2 = eval('/bar#{r1}/'.force_encoding('ascii-8bit'))
|
||||||
|
assert_equal(Encoding::US_ASCII, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('foo'.force_encoding("us-ascii"))
|
||||||
|
r2 = eval('/bar#{r1}/'.force_encoding('ascii-8bit'))
|
||||||
|
assert_equal(Encoding::US_ASCII, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('foo'.force_encoding("ascii-8bit"))
|
||||||
|
r2 = eval('/bar#{r1}/'.force_encoding('us-ascii'))
|
||||||
|
assert_equal(Encoding::US_ASCII, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('foo'.force_encoding("us-ascii"))
|
||||||
|
r2 = eval('/bar#{r1}/'.force_encoding('us-ascii'))
|
||||||
|
assert_equal(Encoding::US_ASCII, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('\xa1'.force_encoding("ascii-8bit"))
|
||||||
|
r2 = eval('/bar#{r1}/'.force_encoding('ascii-8bit'))
|
||||||
|
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('\xa1'.force_encoding("ascii-8bit"))
|
||||||
|
r2 = eval('/bar#{r1}/'.force_encoding('us-ascii'))
|
||||||
|
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('foo'.force_encoding("ascii-8bit"))
|
||||||
|
r2 = eval('/\xa1#{r1}/'.force_encoding('ascii-8bit'))
|
||||||
|
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('foo'.force_encoding("us-ascii"))
|
||||||
|
r2 = eval('/\xa1#{r1}/'.force_encoding('ascii-8bit'))
|
||||||
|
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
|
||||||
|
|
||||||
|
r1 = Regexp.new('\xa1'.force_encoding("ascii-8bit"))
|
||||||
|
r2 = eval('/\xa1#{r1}/'.force_encoding('ascii-8bit'))
|
||||||
|
assert_equal(Encoding::ASCII_8BIT, r2.encoding)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_regexp_embed_preprocess
|
def test_regexp_embed_preprocess
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue