[BREAKING] Feat: quotation is now using ()
This commit is contained in:
@@ -33,7 +33,7 @@ fn range_underflow() {
|
||||
|
||||
#[test]
|
||||
fn gen_basic() {
|
||||
expect_stack("{ 42 } 3 gen", &[int(42), int(42), int(42)]);
|
||||
expect_stack("( 42 ) 3 gen", &[int(42), int(42), int(42)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -42,7 +42,7 @@ fn gen_with_computation() {
|
||||
// 0 → dup(0,0) 1+(0,1) → pop 1, stack [0]
|
||||
// 0 → dup(0,0) 1+(0,1) → pop 1, stack [0]
|
||||
// So we get [0, 1, 1, 1] - the 0 stays, we collect three 1s
|
||||
expect_stack("0 { dup 1 + } 3 gen", &[int(0), int(1), int(1), int(1)]);
|
||||
expect_stack("0 ( dup 1 + ) 3 gen", &[int(0), int(1), int(1), int(1)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -50,12 +50,12 @@ fn gen_chained() {
|
||||
// Start with 1, each iteration: dup, multiply by 2
|
||||
// 1 → dup(1,1) 2*(1,2) → pop 2, stack [1]
|
||||
// 1 → dup(1,1) 2*(1,2) → pop 2, stack [1]
|
||||
expect_stack("1 { dup 2 * } 3 gen", &[int(1), int(2), int(2), int(2)]);
|
||||
expect_stack("1 ( dup 2 * ) 3 gen", &[int(1), int(2), int(2), int(2)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gen_zero() {
|
||||
expect_stack("{ 1 } 0 gen", &[]);
|
||||
expect_stack("( 1 ) 0 gen", &[]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -65,17 +65,17 @@ fn gen_underflow() {
|
||||
|
||||
#[test]
|
||||
fn gen_not_a_number() {
|
||||
expect_error("{ 1 } gen", "expected number");
|
||||
expect_error("( 1 ) gen", "expected number");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gen_negative() {
|
||||
expect_error("{ 1 } -1 gen", "gen count must be >= 0");
|
||||
expect_error("( 1 ) -1 gen", "gen count must be >= 0");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gen_empty_quot_error() {
|
||||
expect_error("{ } 3 gen", "quotation must produce");
|
||||
expect_error("( ) 3 gen", "quotation must produce");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user