fix: 统一属性键字符串化路径

This commit is contained in:
2026-06-08 23:00:27 +08:00
parent 6cb781a3bd
commit 95f5caf3bb
2 changed files with 48 additions and 44 deletions
+20
View File
@@ -117,3 +117,23 @@ fn eval_compound_member_expr_val() {
fn eval_member_multi_inc() {
assert_eq!(eval("var obj={}; obj.x=0; obj.x++; obj.x++; obj.x"), "2");
}
#[test]
fn eval_numeric_property_key_roundtrip() {
assert_eq!(eval("var o={}; o[1]=42; o['1']"), "42");
}
#[test]
fn eval_numeric_dynamic_property_key_roundtrip() {
assert_eq!(eval("var o={}; var k=1; o[k]=42; o['1']"), "42");
}
#[test]
fn eval_numeric_property_key_compound_update() {
assert_eq!(eval("var o={}; o[1]=2; o[1]++; o['1']"), "3");
}
#[test]
fn eval_in_operator_coerces_numeric_key() {
assert_eq!(eval("var o={}; o[1]=42; 1 in o"), "true");
}