Fixed another do_split bug and included a test for the fix.

This commit is contained in:
Seth Hall 2011-04-22 08:00:28 -04:00
parent dbecbccdbc
commit c5a19f7cdc
3 changed files with 16 additions and 1 deletions

View file

@ -244,8 +244,11 @@ Val* do_split(StringVal* str_val, RE_Matcher* re, TableVal* other_sep,
--n;
}
if ( num_sep >= max_num_sep )
if ( max_num_sep && num_sep >= max_num_sep )
{
offset = end_of_s - s;
n=0;
}
Val* ind = new Val(++num, TYPE_COUNT);
a->Assign(ind, new StringVal(offset, (const char*) s));