mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
test: 补 do-while continue 判别性钉——continue 须直达条件位置
既有钉修复前后同值(r=4)不判别 continue 目标位置:新钉 i 到 3 触发 continue,条件直达时 3<3 为假即退得 3,continue 错指体首会跳过条件多跑一轮得 4。
This commit is contained in:
@@ -157,6 +157,13 @@ fn eval_do_while_continue() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn eval_do_while_continue_jumps_to_condition() {
|
||||||
|
// continue 直达条件位置:i 到 3 后 continue,条件 3<3 为假即退,结果 3;
|
||||||
|
// 若 continue 重入体首(跳过条件求值)会多跑一轮得 4。
|
||||||
|
assert_eq!(eval("var i = 0; do { i = i + 1; if (i == 3) continue; } while (i < 3); i"), "3");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn eval_for_in_enumerates_keys() {
|
fn eval_for_in_enumerates_keys() {
|
||||||
assert_eq!(eval("var n=0; for (k in {a:1,b:2}) { n=n+1; } n"), "2");
|
assert_eq!(eval("var n=0; for (k in {a:1,b:2}) { n=n+1; } n"), "2");
|
||||||
|
|||||||
Reference in New Issue
Block a user