mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
string.c: $; name in error message
* string.c (rb_str_split_m): show $; name in error message when it is a wrong object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4e5114b0d1
commit
bd6fe32691
3 changed files with 32 additions and 7 deletions
|
@ -1365,7 +1365,7 @@ CODE
|
|||
end
|
||||
|
||||
def test_split
|
||||
assert_nil($;)
|
||||
fs, $; = $;, nil
|
||||
assert_equal([S("a"), S("b"), S("c")], S(" a b\t c ").split)
|
||||
assert_equal([S("a"), S("b"), S("c")], S(" a b\t c ").split(S(" ")))
|
||||
|
||||
|
@ -1389,6 +1389,13 @@ CODE
|
|||
assert_equal([], "".split(//, 1))
|
||||
|
||||
assert_equal("[2, 3]", [1,2,3].slice!(1,10000).inspect, "moved from btest/knownbug")
|
||||
|
||||
$; = []
|
||||
assert_raise_with_message(TypeError, /\$;/) {
|
||||
"".split
|
||||
}
|
||||
ensure
|
||||
$; = fs
|
||||
end
|
||||
|
||||
def test_split_encoding
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue