File tree Expand file tree Collapse file tree 4 files changed +45
-4
lines changed Expand file tree Collapse file tree 4 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
5
5
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
- refs/heads/try2: c5bcb22719a8af3075fdd204003a748022022479
8
+ refs/heads/try2: fc60ace7a9ec6feed79cf52cc245f4d7c048fc8b
9
9
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ mod test {
127
127
}
128
128
129
129
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 ) ) ) ;
131
131
let cb = ~MyCallback ( rc. clone ( ) , v) ;
132
132
let cb = cb as ~Callback : ;
133
133
let cb = unsafe { cast:: transmute ( cb) } ;
Original file line number Diff line number Diff line change @@ -509,7 +509,7 @@ mod tests {
509
509
}
510
510
}
511
511
512
- let i = Rc :: from_send ( RefCell :: new ( 0 ) ) ;
512
+ let i = Rc :: new ( RefCell :: new ( 0 ) ) ;
513
513
{
514
514
let x = R ( i. clone ( ) ) ;
515
515
let opt = Some ( x) ;
Original file line number Diff line number Diff line change @@ -172,8 +172,49 @@ impl<T> Clone for Weak<T> {
172
172
173
173
#[ cfg( test) ]
174
174
mod tests {
175
+ use prelude:: * ;
175
176
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
+ }
177
218
178
219
#[ test]
179
220
fn test_live ( ) {
You can’t perform that action at this time.
0 commit comments