• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // run-pass
2 #![allow(unused_braces)]
3 #![allow(dead_code)]
4 
5 // Tests for standalone blocks as expressions
6 
test_basic()7 fn test_basic() { let rs: bool = { true }; assert!((rs)); }
8 
9 struct RS { v1: isize, v2: isize }
10 
test_rec()11 fn test_rec() { let rs = { RS {v1: 10, v2: 20} }; assert_eq!(rs.v2, 20); }
12 
test_filled_with_stuff()13 fn test_filled_with_stuff() {
14     let rs = { let mut a = 0; while a < 10 { a += 1; } a };
15     assert_eq!(rs, 10);
16 }
17 
main()18 pub fn main() { test_basic(); test_rec(); test_filled_with_stuff(); }
19