aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/str-append.rs
blob: ed2e3a7a90dbcd7cae7760195c17b4c2f5b50cc8 (plain) (blame)
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
27
28
29
30
// -*- rust -*-

use std;
import std::_str;

fn test1() {
  let str s = "hello";
  s += "world";
  log s;
  assert (s.(9) == ('d' as u8));
}

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

  let str ff = "abc";
  let str a = ff + "ABC" + ff;
  let str b = "ABC" + ff + "ABC";

  log a;
  log b;

  assert (_str::eq(a, "abcABCabc"));
  assert (_str::eq(b, "ABCabcABC"));
}

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