stdlib: Add some funky syntax tests
TODO: make stuff like this into actual lexer->parser->analysis->interpreter tests.
This commit is contained in:
parent
e102ae25b4
commit
9a687624fc
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user