aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-31 21:45:08 -0400
committerBrian Anderson <[email protected]>2011-03-31 23:15:11 -0400
commitc27b72e323d1aabb0eeb9939feb5584bc28ba9e9 (patch)
treeb84947a69de9484f8cf20f51de93b62dc68d9743 /src/test/run-pass
parentUn-XFAIL expr-block-box.rs (diff)
downloadrust-c27b72e323d1aabb0eeb9939feb5584bc28ba9e9.tar.xz
rust-c27b72e323d1aabb0eeb9939feb5584bc28ba9e9.zip
Add another test for blocks as expressions
Diffstat (limited to 'src/test/run-pass')
-rw-r--r--src/test/run-pass/expr-block.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/run-pass/expr-block.rs b/src/test/run-pass/expr-block.rs
new file mode 100644
index 00000000..ecc6f04a
--- /dev/null
+++ b/src/test/run-pass/expr-block.rs
@@ -0,0 +1,31 @@
+// xfail-boot
+// -*- rust -*-
+
+// Tests for standalone blocks as expressions
+
+fn test_basic() {
+ let bool res = { true };
+ check (res);
+}
+
+fn test_rec() {
+ auto res = { rec(v1 = 10, v2 = 20) };
+ check (res.v2 == 20);
+}
+
+fn test_filled_with_stuff() {
+ auto res = {
+ auto a = 0;
+ while (a < 10) {
+ a += 1;
+ }
+ a
+ };
+ check (res == 10);
+}
+
+fn main() {
+ test_basic();
+ test_rec();
+ test_filled_with_stuff();
+}