Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const tests = [
- ' ',
- ' ',
- 'aa',
- 'aa ',
- ' aa',
- 'a b',
- 'aa bb',
- 'aa bb',
- 'aa bb',
- 'aa bb',
- 'aa bb cc',
- ' aa bb cc ',
- ' aa bb cc ',
- ];
- function runTests() {
- for (test of tests) {
- const expected = test.replace(/ +/g, ' ');
- const real = replaceSpace(test);
- if (expected !== real) {
- console.log(`
- test: -${test}-
- expected: -${expected}-
- result: -${real}-
- `);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement