s.split(nil) should work like s.split()

This commit is contained in:
Yukihiro Matsumoto
2012-06-12 12:29:20 +09:00
parent b32e586099
commit 5937c29281
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -2139,7 +2139,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str)
i = 1;
}
if (argc == 0) {
if (argc == 0 || mrb_nil_p(spat)) {
split_type = awk;
}
else {
+3 -1
View File
@@ -277,9 +277,11 @@ assert('String#split', '15.2.10.5.35') do
# without RegExp behavior is actually unspecified
a = 'abc abc abc'.split
b = 'a,b,c,,d'.split(',')
c = 'abc abc abc'.split(nil)
a == ['abc', 'abc', 'abc'] and
b == ["a", "b", "c", "", "d"]
b == ["a", "b", "c", "", "d"] and
c == ['abc', 'abc', 'abc']
end
# TODO ATM broken assert('String#sub', '15.2.10.5.36') do