diff options
| author | Taiki Endo <te316e89@gmail.com> | 2019-05-19 22:17:12 +0900 |
|---|---|---|
| committer | Taiki Endo <te316e89@gmail.com> | 2019-05-19 22:17:12 +0900 |
| commit | 3e73ca6e336650eb0cb8429b3932d63d71c2a476 (patch) | |
| tree | 5678f2dbea3839d0a4aae471be895879259066a2 /src/test/ui/self/string-self-append.rs | |
| parent | b53d839b239d8fcf4cddfbd565ce5a8836217d5c (diff) | |
| download | rust-3e73ca6e336650eb0cb8429b3932d63d71c2a476.tar.gz rust-3e73ca6e336650eb0cb8429b3932d63d71c2a476.zip | |
Move run-pass/self/* to ui/self
Diffstat (limited to 'src/test/ui/self/string-self-append.rs')
| -rw-r--r-- | src/test/ui/self/string-self-append.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/self/string-self-append.rs b/src/test/ui/self/string-self-append.rs new file mode 100644 index 00000000000..e63dc0090cb --- /dev/null +++ b/src/test/ui/self/string-self-append.rs @@ -0,0 +1,14 @@ +// run-pass +pub fn main() { + // Make sure we properly handle repeated self-appends. + let mut a: String = "A".to_string(); + let mut i = 20; + let mut expected_len = 1; + while i > 0 { + println!("{}", a.len()); + assert_eq!(a.len(), expected_len); + a = format!("{}{}", a, a); + i -= 1; + expected_len *= 2; + } +} |
