PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/string-self-append.rs

http://github.com/jruderman/rust
Rust | 16 lines | 14 code | 1 blank | 1 comment | 2 complexity | 5dc3814f5f5febbb90d18bb59fbdf120 MD5 | raw file
 1use std;
 2import str;
 3
 4fn main() {
 5    // Make sure we properly handle repeated self-appends.
 6    let mut a: ~str = ~"A";
 7    let mut i = 20;
 8    let mut expected_len = 1u;
 9    while i > 0 {
10        log(error, str::len(a));
11        assert (str::len(a) == expected_len);
12        a += a;
13        i -= 1;
14        expected_len *= 2u;
15    }
16}