Feat: add slicing words

This commit is contained in:
2026-02-28 02:37:09 +01:00
parent 511726b65b
commit 7ae3f255b0
6 changed files with 46 additions and 13 deletions

View File

@@ -196,21 +196,21 @@ fn ifelse_false() {
}
#[test]
fn pick_first() {
expect_int("{ 10 } { 20 } { 30 } 0 pick", 10);
fn select_first() {
expect_int("{ 10 } { 20 } { 30 } 0 select", 10);
}
#[test]
fn pick_second() {
expect_int("{ 10 } { 20 } { 30 } 1 pick", 20);
fn select_second() {
expect_int("{ 10 } { 20 } { 30 } 1 select", 20);
}
#[test]
fn pick_third() {
expect_int("{ 10 } { 20 } { 30 } 2 pick", 30);
fn select_third() {
expect_int("{ 10 } { 20 } { 30 } 2 select", 30);
}
#[test]
fn pick_preserves_stack() {
expect_int("5 { 10 } { 20 } 0 pick +", 15);
fn select_preserves_stack() {
expect_int("5 { 10 } { 20 } 0 select +", 15);
}