mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
more tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
56f8092459
commit
be98b422b0
1 changed files with 49 additions and 0 deletions
|
@ -121,3 +121,52 @@ assert_equal 'true', %q{
|
|||
s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
s.gsub(/\xa3\xb1/e, "z") == "\xa3\xb0z\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
}
|
||||
|
||||
assert_equal 'false', %q{
|
||||
s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
s.include?("\xb0\xa3".force_encoding("euc-jp"))
|
||||
}
|
||||
|
||||
assert_equal 'nil', %q{
|
||||
s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
s.index("\xb3\xa3".force_encoding("euc-jp"))
|
||||
}
|
||||
|
||||
assert_equal 'ok', %q{
|
||||
s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
s.insert(-1, "a")
|
||||
:ok
|
||||
}
|
||||
|
||||
assert_finish 1, %q{ "\xa3\xfe".force_encoding("euc-jp").next }
|
||||
|
||||
assert_equal 'ok', %q{
|
||||
s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
begin
|
||||
s.rindex("\xb1\xa3".force_encoding("ascii-8bit"))
|
||||
:ng
|
||||
rescue ArgumentError
|
||||
:ok
|
||||
end
|
||||
}
|
||||
|
||||
assert_equal 'true', %q{
|
||||
s = "\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
s.split("\xa3\xb1".force_encoding("euc-jp")) == [
|
||||
"\xa3\xb0".force_encoding("euc-jp")
|
||||
"\xa3\xb2\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
]
|
||||
}
|
||||
|
||||
assert_equal 'true', %q{
|
||||
s = "\xa3\xb0\xa3\xb1\xa3\xb1\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
s.squeeze == "\xa3\xb0\xa3\xb1\xa3\xb3\xa3\xb4".force_encoding("euc-jp")
|
||||
}
|
||||
|
||||
assert_normal_exit %q{
|
||||
"\x81\x41".force_encoding("shift_jis").tr("A", "B")
|
||||
}
|
||||
|
||||
assert_normal_exit %q{
|
||||
"\x81\x41".force_encoding("shift_jis").tr_s("A", "B")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue