Commit 5937c292 authored by Yukihiro Matsumoto's avatar Yukihiro Matsumoto

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

parent b32e5860
......@@ -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 {
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment