2019-07-26 16:54:25 -05:00
|
|
|
// run-pass
|
|
|
|
|
2018-09-14 05:20:28 -05:00
|
|
|
#![allow(dead_code)]
|
2011-06-15 13:19:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-03-31 20:45:08 -05:00
|
|
|
|
|
|
|
// Tests for standalone blocks as expressions
|
2015-03-22 15:13:15 -05:00
|
|
|
|
2013-03-28 20:39:09 -05:00
|
|
|
fn test_basic() { let rs: bool = { true }; assert!((rs)); }
|
2011-03-31 20:45:08 -05:00
|
|
|
|
2015-03-25 19:06:52 -05:00
|
|
|
struct RS { v1: isize, v2: isize }
|
2013-01-26 00:46:32 -06:00
|
|
|
|
2015-06-07 13:00:38 -05:00
|
|
|
fn test_rec() { let rs = { RS {v1: 10, v2: 20} }; assert_eq!(rs.v2, 20); }
|
2011-03-31 20:45:08 -05:00
|
|
|
|
|
|
|
fn test_filled_with_stuff() {
|
2015-01-25 15:05:03 -06:00
|
|
|
let rs = { let mut a = 0; while a < 10 { a += 1; } a };
|
2013-05-18 21:02:45 -05:00
|
|
|
assert_eq!(rs, 10);
|
2011-03-31 20:45:08 -05:00
|
|
|
}
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
pub fn main() { test_basic(); test_rec(); test_filled_with_stuff(); }
|