Skip to content

Commit 5e35d49

Browse files
committed
Moving the arc tests into arc.rs.
1 parent aa2efc0 commit 5e35d49

File tree

2 files changed

+31
-28
lines changed

2 files changed

+31
-28
lines changed

src/libstd/arc.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,34 @@ fn get_arc<T: send const>(c: comm::chan<proto<T>>) -> arc::arc<T> {
106106
c.send(shared_get(chan(p)));
107107
p.recv()
108108
}
109+
110+
#[cfg(test)]
111+
mod tests {
112+
import comm::*;
113+
114+
#[test]
115+
fn manually_share_arc() {
116+
let v = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
117+
let arc_v = arc::arc(v);
118+
119+
let p = port();
120+
let c = chan(p);
121+
122+
task::spawn() {||
123+
let p = port();
124+
c.send(chan(p));
125+
126+
let arc_v = p.recv();
127+
128+
let v = *arc::get::<[int]>(&arc_v);
129+
assert v[3] == 4;
130+
};
131+
132+
let c = p.recv();
133+
c.send(arc::clone(&arc_v));
134+
135+
assert (*arc::get(&arc_v))[2] == 3;
136+
137+
log(info, arc_v);
138+
}
139+
}

src/test/run-pass/share-arc.rs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)