67 lines
1009 B
Common Lisp
67 lines
1009 B
Common Lisp
|
|
//! Tests for funky behavior
|
|
use super::preamble::*;
|
|
|
|
struct UnitLike;
|
|
|
|
struct TupleLike(super::i32, super::self::test::char)
|
|
|
|
struct StructLike {
|
|
pub member1: UnitLike,
|
|
member2: TupleLike,
|
|
}
|
|
|
|
enum NeverLike;
|
|
|
|
enum EmptyLike {
|
|
Empty,
|
|
}
|
|
|
|
enum Hodgepodge {
|
|
Empty,
|
|
UnitLike (),
|
|
Tuple (TupleLike),
|
|
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
|
|
}
|
|
}
|
|
|
|
fn if_else() -> i32 {
|
|
// block 1
|
|
let x = 10;
|
|
let y = x + 2;
|
|
|
|
if x > 10
|
|
// compare x and 10
|
|
// end block 1, goto block 2 else goto block 3
|
|
{
|
|
// block 2
|
|
4
|
|
// end block 2, goto block 4
|
|
} else {
|
|
// block 3
|
|
5
|
|
// end block 3, goto block 4
|
|
}
|
|
// block 4
|
|
}
|
|
|
|
let x = 0;
|