[BREAKING] Feat: quotation is now using ()

This commit is contained in:
2026-02-28 20:25:59 +01:00
parent ec98274dfe
commit 651ed1219d
24 changed files with 182 additions and 169 deletions

View File

@@ -46,20 +46,20 @@ fn pcycle_by_iter() {
#[test]
fn cycle_with_quotations() {
let ctx = ctx_with(|c| c.runs = 0);
let f = run_ctx("5 { dup } { 2 * } 2 cycle", &ctx);
let f = run_ctx("5 ( dup ) ( 2 * ) 2 cycle", &ctx);
let stack = f.stack();
assert_eq!(stack.len(), 2);
assert_eq!(stack_int(&f), 5);
let ctx = ctx_with(|c| c.runs = 1);
let f = run_ctx("5 { dup } { 2 * } 2 cycle", &ctx);
let f = run_ctx("5 ( dup ) ( 2 * ) 2 cycle", &ctx);
assert_eq!(stack_int(&f), 10);
}
#[test]
fn cycle_executes_quotation() {
let ctx = ctx_with(|c| c.runs = 0);
let f = run_ctx("10 { 3 + } { 5 + } 2 cycle", &ctx);
let f = run_ctx("10 ( 3 + ) ( 5 + ) 2 cycle", &ctx);
assert_eq!(stack_int(&f), 13);
}
@@ -108,11 +108,11 @@ fn bracket_cycle() {
#[test]
fn bracket_with_quotations() {
let ctx = ctx_with(|c| c.runs = 0);
let f = run_ctx("5 [ { 3 + } { 5 + } ] cycle", &ctx);
let f = run_ctx("5 [ ( 3 + ) ( 5 + ) ] cycle", &ctx);
assert_eq!(stack_int(&f), 8);
let ctx = ctx_with(|c| c.runs = 1);
let f = run_ctx("5 [ { 3 + } { 5 + } ] cycle", &ctx);
let f = run_ctx("5 [ ( 3 + ) ( 5 + ) ] cycle", &ctx);
assert_eq!(stack_int(&f), 10);
}
@@ -172,7 +172,7 @@ fn index_negative_wraps() {
#[test]
fn index_with_quotation() {
expect_int("5 [ { 3 + } { 5 + } ] 0 index", 8);
expect_int("5 [ ( 3 + ) ( 5 + ) ] 0 index", 8);
}
#[test]