summary refs log tree commit diff
path: root/src/test/run-pass/str-append.rs
blob: 03cda225bf6f1cd78a8f0426b77f9e15e6628898 (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
26


// -*- rust -*-
use std;
import str;

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 (str::eq(a, "abcABCabc"));
    assert (str::eq(b, "ABCabcABC"));
}

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