Small fixes and additions
All checks were successful
Deploy Website / deploy (push) Has been skipped

This commit is contained in:
2026-03-05 19:20:52 +01:00
parent 0097777449
commit 5a72e4cef4
6 changed files with 76 additions and 66 deletions

View File

@@ -59,20 +59,20 @@ fn nested_quotations() {
#[test]
fn quotation_with_param() {
let outputs = expect_outputs(r#""kick" s ( 2 distort ) 1 ? ."#, 1);
let outputs = expect_outputs(r#""kick" snd ( 2 distort ) 1 ? ."#, 1);
assert!(outputs[0].contains("distort/2"));
}
#[test]
fn quotation_skips_param() {
let outputs = expect_outputs(r#""kick" s ( 2 distort ) 0 ? ."#, 1);
let outputs = expect_outputs(r#""kick" snd ( 2 distort ) 0 ? ."#, 1);
assert!(!outputs[0].contains("distort"));
}
#[test]
fn quotation_with_emit() {
// When true, . should fire
let outputs = expect_outputs(r#""kick" s ( . ) 1 ?"#, 1);
let outputs = expect_outputs(r#""kick" snd ( . ) 1 ?"#, 1);
assert!(outputs[0].contains("kick"));
}
@@ -81,7 +81,7 @@ fn quotation_skips_emit() {
// When false, . should not fire
let f = forth();
let outputs = f
.evaluate(r#""kick" s ( . ) 0 ?"#, &default_ctx())
.evaluate(r#""kick" snd ( . ) 0 ?"#, &default_ctx())
.unwrap();
// No output since . was skipped and no implicit emit
assert_eq!(outputs.len(), 0);
@@ -109,7 +109,7 @@ fn every_with_quotation_integration() {
let ctx = ctx_with(|c| c.iter = iter);
let f = forth();
let outputs = f
.evaluate(r#""kick" s ( 2 distort ) 2 every ."#, &ctx)
.evaluate(r#""kick" snd ( 2 distort ) 2 every ."#, &ctx)
.unwrap();
if iter % 2 == 0 {
assert!(
@@ -134,7 +134,7 @@ fn bjork_with_sound() {
let ctx = ctx_with(|c| c.runs = 2); // position 2 is a hit for (3,8)
let f = forth();
let outputs = f
.evaluate(r#""kick" s ( 2 distort ) 3 8 bjork ."#, &ctx)
.evaluate(r#""kick" snd ( 2 distort ) 3 8 bjork ."#, &ctx)
.unwrap();
assert!(outputs[0].contains("distort/2"));
}
@@ -161,7 +161,7 @@ fn when_and_unless_complementary() {
let f = forth();
let outputs = f
.evaluate(
r#""kick" s ( 2 distort ) iter 2 mod 0 = ? ( 4 distort ) iter 2 mod 0 = !? ."#,
r#""kick" snd ( 2 distort ) iter 2 mod 0 = ? ( 4 distort ) iter 2 mod 0 = !? ."#,
&ctx,
)
.unwrap();