rust/src/test/run-pass/string-self-append.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

17 lines
334 B
Rust

use std;
import std::str;
fn main() {
// Make sure we properly handle repeated self-appends.
let a: str = "A";
let i = 20;
let expected_len = 1u;
while i > 0 {
log_err str::byte_len(a);
assert (str::byte_len(a) == expected_len);
a += a;
i -= 1;
expected_len *= 2u;
}
}