Add more edge cases tests to split

This commit is contained in:
Clément 2022-04-15 12:13:00 +01:00 committed by GitHub
parent 2e712343bc
commit eb2579a9e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -9,6 +9,11 @@ const t = (f) => tests.push(f)
t(({ eq }) => eq(split('a b c', ' '), ['a', 'b', 'c']))
t(({ eq }) => eq(split('ggg - ddd - b', ' - '), ['ggg', 'ddd', 'b']))
t(({ eq }) => eq(split('ee,ff,g,', ','), ['ee', 'ff', 'g', '']))
t(({ eq }) => eq(split('Riad', ' '), ['Riad']))
t(({ eq }) => eq(split('rrrr', 'rr'), ['', '', '']))
t(({ eq }) => eq(split('rrirr', 'rr'), ['', 'i', '']))
t(({ eq }) => eq(split('Riad', ''), ['R', 'i', 'a', 'd']))
t(({ eq }) => eq(split('', 'Riad'), ['']))
t(() => join(['ee', 'ff', 'g', ''], ',') === 'ee,ff,g,')
t(() => join(['ggg', 'ddd', 'b'], ' - ') === 'ggg - ddd - b')