Skip to content

Commit fa01dba

Browse files
committed
---
yaml --- r: 148157 b: refs/heads/try2 c: fc60ace h: refs/heads/master i: 148155: 9c412c5 v: v3
1 parent 5c373cb commit fa01dba

File tree

4 files changed

+45
-4
lines changed

4 files changed

+45
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: c5bcb22719a8af3075fdd204003a748022022479
8+
refs/heads/try2: fc60ace7a9ec6feed79cf52cc245f4d7c048fc8b
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustuv/idle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ mod test {
127127
}
128128

129129
fn mk(v: uint) -> (~IdleWatcher, Chan) {
130-
let rc = Rc::from_send(RefCell::new((None, 0)));
130+
let rc = Rc::new(RefCell::new((None, 0)));
131131
let cb = ~MyCallback(rc.clone(), v);
132132
let cb = cb as ~Callback:;
133133
let cb = unsafe { cast::transmute(cb) };

branches/try2/src/libstd/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ mod tests {
509509
}
510510
}
511511

512-
let i = Rc::from_send(RefCell::new(0));
512+
let i = Rc::new(RefCell::new(0));
513513
{
514514
let x = R(i.clone());
515515
let opt = Some(x);

branches/try2/src/libstd/rc.rs

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,49 @@ impl<T> Clone for Weak<T> {
172172

173173
#[cfg(test)]
174174
mod tests {
175+
use prelude::*;
175176
use super::*;
176-
use prelude::drop;
177+
use cell::RefCell;
178+
179+
#[test]
180+
fn test_clone() {
181+
let x = Rc::new(RefCell::new(5));
182+
let y = x.clone();
183+
x.borrow().with_mut(|inner| {
184+
*inner = 20;
185+
});
186+
assert_eq!(y.borrow().with(|v| *v), 20);
187+
}
188+
189+
#[test]
190+
fn test_deep_clone() {
191+
let x = Rc::new(RefCell::new(5));
192+
let y = x.deep_clone();
193+
x.borrow().with_mut(|inner| {
194+
*inner = 20;
195+
});
196+
assert_eq!(y.borrow().with(|v| *v), 5);
197+
}
198+
199+
#[test]
200+
fn test_simple() {
201+
let x = Rc::new(5);
202+
assert_eq!(*x.borrow(), 5);
203+
}
204+
205+
#[test]
206+
fn test_simple_clone() {
207+
let x = Rc::new(5);
208+
let y = x.clone();
209+
assert_eq!(*x.borrow(), 5);
210+
assert_eq!(*y.borrow(), 5);
211+
}
212+
213+
#[test]
214+
fn test_destructor() {
215+
let x = Rc::new(~5);
216+
assert_eq!(**x.borrow(), 5);
217+
}
177218

178219
#[test]
179220
fn test_live() {

0 commit comments

Comments
 (0)