1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

update tests for latest /.../n handling.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-22 06:00:56 +00:00
parent 0067dc24d8
commit da8b4a5e41

View file

@ -224,24 +224,34 @@ class TestM17N < Test::Unit::TestCase
}
end
def test_regexp_ascii_none
begin
old_verbose = $VERBOSE
$VERBOSE = nil
assert_regexp_generic_ascii(/a/n)
[/a/n].each {|r|
assert_equal(0, r =~ a("a"))
assert_equal(0, r =~ e("a"))
assert_equal(0, r =~ s("a"))
assert_equal(0, r =~ u("a"))
assert_equal(nil, r =~ a("\xc2\xa1"))
assert_equal(nil, r =~ e("\xc2\xa1"))
assert_equal(nil, r =~ s("\xc2\xa1"))
assert_equal(nil, r =~ u("\xc2\xa1"))
}
ensure
$VERBOSE = old_verbose
end
end
def test_regexp_ascii
assert_regexp_fixed_ascii8bit(/a/n)
assert_regexp_fixed_ascii8bit(/\xc2\xa1/n)
assert_regexp_fixed_ascii8bit(eval(a(%{/\xc2\xa1/})))
assert_regexp_fixed_ascii8bit(eval(a(%{/\xc2\xa1/n})))
assert_regexp_fixed_ascii8bit(eval(a(%q{/\xc2\xa1/})))
[/a/n].each {|r|
assert_equal(0, r =~ a("a"))
assert_equal(0, r =~ e("a"))
assert_equal(0, r =~ s("a"))
assert_equal(0, r =~ u("a"))
assert_equal(nil, r =~ a("\xc2\xa1"))
assert_raise(ArgumentError) { r =~ e("\xc2\xa1") }
assert_raise(ArgumentError) { r =~ s("\xc2\xa1") }
assert_raise(ArgumentError) { r =~ u("\xc2\xa1") }
}
[/\xc2\xa1/n, eval(a(%{/\xc2\xa1/})), eval(a(%{/\xc2\xa1/n}))].each {|r|
assert_equal(nil, r =~ a("a"))
assert_equal(nil, r =~ e("a"))
@ -380,7 +390,7 @@ class TestM17N < Test::Unit::TestCase
def test_union_1_regexp
assert_regexp_generic_ascii(Regexp.union(//))
assert_regexp_fixed_ascii8bit(Regexp.union(//n))
assert_regexp_generic_ascii(Regexp.union(//n))
assert_regexp_fixed_eucjp(Regexp.union(//e))
assert_regexp_fixed_sjis(Regexp.union(//s))
assert_regexp_fixed_utf8(Regexp.union(//u))
@ -421,7 +431,7 @@ class TestM17N < Test::Unit::TestCase
end
def test_dynamic_ascii_regexp
assert_regexp_fixed_ascii8bit(/#{}/n)
assert_regexp_generic_ascii(/#{}/n)
assert_regexp_fixed_ascii8bit(/#{}\xc2\xa1/n)
assert_regexp_fixed_ascii8bit(/\xc2\xa1#{}/n)
#assert_raise(SyntaxError) { s1, s2 = s('\xc2'), s('\xa1'); /#{s1}#{s2}/ }