about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/ifmt.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs
index cef2f879f9c..08e9990511f 100644
--- a/src/test/run-pass/ifmt.rs
+++ b/src/test/run-pass/ifmt.rs
@@ -13,6 +13,7 @@
 #![allow(unused_features)]
 #![feature(box_syntax)]
 
+use std::cell::RefCell;
 use std::fmt::{self, Write};
 use std::usize;
 
@@ -240,6 +241,8 @@ pub fn main() {
     // test that trailing commas are acceptable
     format!("{}", "test",);
     format!("{foo}", foo="test",);
+
+    test_refcell();
 }
 
 // Basic test to make sure that we can invoke the `write!` macro with an
@@ -319,3 +322,12 @@ fn test_once() {
     assert_eq!(format!("{0} {0} {0} {a} {a} {a}", foo(), a=foo()),
                "1 1 1 2 2 2".to_string());
 }
+
+fn test_refcell() {
+    let refcell = RefCell::new(5);
+    assert_eq!(format!("{:?}", refcell), "RefCell { value: 5 }");
+    let borrow = refcell.borrow_mut();
+    assert_eq!(format!("{:?}", refcell), "RefCell { value: <borrowed> }");
+    drop(borrow);
+    assert_eq!(format!("{:?}", refcell), "RefCell { value: 5 }");
+}