fix: split 委托 Symbol.split 并补零宽与 limit 口径

This commit is contained in:
2026-09-22 07:45:34 +00:00
parent 169f4b2984
commit fb9365bde2
6 changed files with 258 additions and 92 deletions
@@ -789,6 +789,16 @@ fn symbol_split_limit_zero_and_to_uint32() {
assert_eq!(to_str(&vm, result), "limit-boom");
}
#[test]
fn symbol_split_undefined_limit_full() {
// limit 缺省与显式 undefined 均为 2^32-1 全量(非 ToUint32(NaN)=0)。
let mut vm = Vm::new();
let result = eval(&mut vm, "RegExp.prototype[Symbol.split].call(/,/, 'a,b', undefined).length").unwrap();
assert!(result.as_int() == 2);
let result = eval(&mut vm, "'a,b'.split(/,/, undefined).length").unwrap();
assert!(result.as_int() == 2);
}
#[test]
fn symbol_match_all_species_matcher_and_cached_lastindex() {
let mut vm = Vm::new();