stdlib: Add some funky syntax tests

TODO: make stuff like this into actual lexer->parser->analysis->interpreter tests.
This commit is contained in:
John 2024-04-18 21:10:11 -05:00
parent e102ae25b4
commit 9a687624fc

View File

@ -60,16 +60,6 @@ fn if_else() -> i32 {
// block 4
}
fn while_else() -> i32 {
loop {
if conditional {
body;
} else {
break { else_body };
}
}
}
#[cfg("test")]
mod test {
//! Tests for funky behavior
@ -96,4 +86,22 @@ mod test {
StructEmpty {},
StructLike { member1: UnitLike, member2: TupleLike },
}
fn noop () -> bool {
loop if false {
} else break loop if false {
} else break loop if false {
} else break true;
}
fn while_else() -> i32 {
while conditional {
pass
} else {
fail
}
}
}