Skip to content

Commit 3814d8d

Browse files
committed
Convert run-pass/vec-append to ivecs
1 parent c06d95f commit 3814d8d

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

src/test/run-pass/vec-append.rs

+14-20
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,33 @@
33
// -*- rust -*-
44
use std;
55
import std::str;
6-
import std::vec;
7-
6+
import std::ivec;
87

98
// FIXME: import std::dbg::const_refcount. Currently
109
// cross-crate const references don't work.
1110
const const_refcount: uint = 0x7bad_face_u;
1211

1312
fn fast_growth() {
14-
let v: vec[int] = [1, 2, 3, 4, 5];
15-
v += [6, 7, 8, 9, 0];
13+
let v: [int] = ~[1, 2, 3, 4, 5];
14+
v += ~[6, 7, 8, 9, 0];
1615
log v.(9);
1716
assert (v.(0) == 1);
1817
assert (v.(7) == 8);
1918
assert (v.(9) == 0);
2019
}
2120

2221
fn slow_growth() {
23-
let v: vec[int] = [];
24-
let u: vec[int] = v;
25-
v += [17];
22+
let v: [int] = ~[];
23+
let u: [int] = v;
24+
v += ~[17];
2625
log v.(0);
2726
assert (v.(0) == 17);
2827
}
2928

3029
fn slow_growth2_helper(s: str) { // ref up: s
3130

32-
obj acc(mutable v: vec[str]) {
33-
fn add(s: &str) { v += [s]; }
31+
obj acc(mutable v: [str]) {
32+
fn add(s: &str) { v += ~[s]; }
3433
}
3534
let ss: str = s; // ref up: s
3635

@@ -47,26 +46,21 @@ fn slow_growth2_helper(s: str) { // ref up: s
4746
* mumble, the existing str in the originally- shared vec.
4847
*/
4948

50-
let v: vec[str] = [mumble]; // ref up: v, mumble
49+
let v: [str] = ~[mumble]; // ref up: mumble
5150

52-
log vec::refcount[str](v);
53-
let a: acc = acc(v); // ref up: a, v
51+
let a: acc = acc(v);
5452

55-
log vec::refcount[str](v);
56-
assert (vec::refcount[str](v) == 2u);
57-
a.add(s); // ref up: mumble, s. ref down: v
53+
a.add(s); // ref up: mumble, s
5854

59-
log vec::refcount[str](v);
6055
log str::refcount(s);
6156
log str::refcount(mumble);
62-
assert (vec::refcount[str](v) == 1u);
6357
assert (str::refcount(s) == const_refcount);
6458
assert (str::refcount(mumble) == const_refcount);
6559
log v.(0);
66-
log vec::len[str](v);
60+
log ivec::len[str](v);
6761
assert (str::eq(v.(0), mumble));
68-
assert (vec::len[str](v) == 1u);
69-
} // ref down: a, mumble, s, v
62+
assert (ivec::len[str](v) == 1u);
63+
} // ref down: mumble, s,
7064

7165
log str::refcount(s);
7266
log str::refcount(mumble);

0 commit comments

Comments
 (0)