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

25 lines
721 B
Ruby
Raw Normal View History

# vim: set fileencoding=euc-jp
require "test/unit"
class TestEUC_JP < Test::Unit::TestCase
def test_mbc_case_fold
assert_match(/(<28><>)(a)\1\2/i, "<EFBFBD><EFBFBD>a<EFBFBD><EFBFBD>A")
assert_no_match(/(<28><>)(a)\1\2/i, "<EFBFBD><EFBFBD>a<EFBFBD><EFBFBD>A")
end
def test_property
assert_match(/<EFBFBD><EFBFBD>{0}\p{Hiragana}{4}/, "<EFBFBD>Ҥ餬<EFBFBD><EFBFBD>")
assert_no_match(/<EFBFBD><EFBFBD>{0}\p{Hiragana}{4}/, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
assert_no_match(/<EFBFBD><EFBFBD>{0}\p{Hiragana}{4}/, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
assert_no_match(/<EFBFBD><EFBFBD>{0}\p{Katakana}{4}/, "<EFBFBD>Ҥ餬<EFBFBD><EFBFBD>")
assert_match(/<EFBFBD><EFBFBD>{0}\p{Katakana}{4}/, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
assert_no_match(/<EFBFBD><EFBFBD>{0}\p{Katakana}{4}/, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
assert_raise(RegexpError) { Regexp.new('<27><>{0}\p{foobarbaz}') }
end
def test_charboundary
assert_nil(/\xA2\xA2/ =~ "\xA1\xA2\xA2\xA3")
end
end