1
0
Fork 0
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@14249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-12-16 02:17:42 +00:00
parent bcf4a9947d
commit 22456e709d

View file

@ -193,3 +193,64 @@ assert_equal 'nil', %q{
t.join
exc.inspect
}, '[ruby-dev:32608]'
assert_equal 'true', %q{
"abc".sub(/b/, "\xa1\xa1".force_encoding("euc-jp")) ==
"a\xa1\xa1c".force_encoding("euc-jp")
}
assert_equal 'ok', %q{
begin
"%s%s" % ["\xc2\xa1".force_encoding("sjis"), "\xc2\xa1".force_encoding("euc-jp")]
rescue ArgumentError
:ok
end
}
assert_equal '0', %q{
"\xa1\xa2".force_encoding("euc-jp").count("z")
}
assert_equal '1', %q{
"\xa1\xa2".force_encoding("euc-jp").delete("z").length
}
assert_equal 'false', %q{
"\xa1\xa2\xa3\xa4".force_encoding("euc-jp").include?("\xa3".force_encoding("euc-jp"))
}
assert_equal 'nil', %q{
"\xa1\xa2\xa3\xa4".force_encoding("euc-jp").index("\xa3".force_encoding("euc-jp"))
}
assert_equal 'nil', %q{
"\xa1\xa2\xa3\xa4".force_encoding("euc-jp").rindex("\xa3".force_encoding("euc-jp"))
}
assert_equal 'false', %q{
s1 = "\xa1\xa1".force_encoding("euc-jp")
s2 = s1.dup
(94*94+94).times { s2.next! }
s1 == s2
}
assert_equal 'ok', %q{
"\xa1\xa2a\xa3\xa4".force_encoding("euc-jp").scan(/a/)
:ok
}
assert_equal 'ok', %q{
"\xa1\xa2a\xa3\xa4".force_encoding("euc-jp").split(/a/)
:ok
}
assert_equal 'ok', %q{
s1 = "\xa1\xa2".force_encoding("euc-jp")
s2 = "\xa1\xa2".force_encoding("sjis")
begin
s1.upto(s2) {|x| break }
:ng
rescue ArgumentError
:ok
end
}