fix: js string split (#38233)

fix #38229
This commit is contained in:
wxiaoguang
2026-06-27 20:09:01 +08:00
committed by GitHub
parent b565f3e00a
commit 16c3216dc6
4 changed files with 60 additions and 18 deletions

View File

@@ -0,0 +1,13 @@
import {cutString} from './string.ts';
test('cutString', () => {
let [before, after, ok] = cutString('a = b = c', '=');
expect(before).toBe('a ');
expect(after).toBe(' b = c');
expect(ok).toBe(true);
[before, after, ok] = cutString(' a ', '=');
expect(before).toBe(' a ');
expect(after).toBe('');
expect(ok).toBe(false);
});