diff options
Diffstat (limited to 'src/vs/base/test/common/strings.test.ts')
-rw-r--r-- | src/vs/base/test/common/strings.test.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/vs/base/test/common/strings.test.ts b/src/vs/base/test/common/strings.test.ts index 8d27e715931..6744ea9a371 100644 --- a/src/vs/base/test/common/strings.test.ts +++ b/src/vs/base/test/common/strings.test.ts @@ -386,4 +386,13 @@ suite('Strings', () => { assert.strictEqual('hello world', strings.truncate('hello world', 100)); assert.strictEqual('hello…', strings.truncate('hello world', 5)); }); + + test('replaceAsync', async () => { + let i = 0; + assert.strictEqual(await strings.replaceAsync('abcabcabcabc', /b(.)/g, async (match, after) => { + assert.strictEqual(match, 'bc'); + assert.strictEqual(after, 'c'); + return `${i++}${after}`; + }), 'a0ca1ca2ca3c'); + }); }); |