2011-04-01 01:45:08 +00:00
|
|
|
// -*- rust -*-
|
|
|
|
|
|
|
|
// Tests for standalone blocks as expressions
|
|
|
|
|
|
|
|
fn test_basic() {
|
|
|
|
let bool res = { true };
|
2011-05-03 00:47:24 +00:00
|
|
|
assert (res);
|
2011-04-01 01:45:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_rec() {
|
|
|
|
auto res = { rec(v1 = 10, v2 = 20) };
|
2011-05-03 00:47:24 +00:00
|
|
|
assert (res.v2 == 20);
|
2011-04-01 01:45:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_filled_with_stuff() {
|
|
|
|
auto res = {
|
|
|
|
auto a = 0;
|
|
|
|
while (a < 10) {
|
|
|
|
a += 1;
|
|
|
|
}
|
|
|
|
a
|
|
|
|
};
|
2011-05-03 00:47:24 +00:00
|
|
|
assert (res == 10);
|
2011-04-01 01:45:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
test_basic();
|
|
|
|
test_rec();
|
|
|
|
test_filled_with_stuff();
|
|
|
|
}
|