diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-27 01:33:01 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-27 18:56:16 +0300 |
| commit | 9be35f82c1abf2ecbab489bca9eca138ea648312 (patch) | |
| tree | 69888506e34af447d9748c0d542de3ba1dd76210 /src/test/ui/expr-block.rs | |
| parent | ca9faa52f5ada0054b1fa27d97aedf448afb059b (diff) | |
| download | rust-9be35f82c1abf2ecbab489bca9eca138ea648312.tar.gz rust-9be35f82c1abf2ecbab489bca9eca138ea648312.zip | |
tests: Move run-pass tests without naming conflicts to ui
Diffstat (limited to 'src/test/ui/expr-block.rs')
| -rw-r--r-- | src/test/ui/expr-block.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/expr-block.rs b/src/test/ui/expr-block.rs new file mode 100644 index 00000000000..549ccf9774f --- /dev/null +++ b/src/test/ui/expr-block.rs @@ -0,0 +1,21 @@ +// run-pass + +#![allow(dead_code)] + + + + +// Tests for standalone blocks as expressions + +fn test_basic() { let rs: bool = { true }; assert!((rs)); } + +struct RS { v1: isize, v2: isize } + +fn test_rec() { let rs = { RS {v1: 10, v2: 20} }; assert_eq!(rs.v2, 20); } + +fn test_filled_with_stuff() { + let rs = { let mut a = 0; while a < 10 { a += 1; } a }; + assert_eq!(rs, 10); +} + +pub fn main() { test_basic(); test_rec(); test_filled_with_stuff(); } |
