summary refs log tree commit diff
path: root/src/test/run-pass/str-append.rs
blob: 16e670b08b7628d7997c25831e26d6ad83c57e0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25


// -*- rust -*-
extern mod std;

fn test1() {
    let mut s: ~str = ~"hello";
    s += ~"world";
    log(debug, s);
    assert (s[9] == 'd' as u8);
}

fn test2() {
    // This tests for issue #163

    let ff: ~str = ~"abc";
    let a: ~str = ff + ~"ABC" + ff;
    let b: ~str = ~"ABC" + ff + ~"ABC";
    log(debug, a);
    log(debug, b);
    assert (a == ~"abcABCabc");
    assert (b == ~"ABCabcABC");
}

fn main() { test1(); test2(); }