Move format-ref-cell test

This commit is contained in:
Alexis Bourget 2020-09-13 18:59:18 +02:00
parent f6a4189d05
commit 5be843fc54
2 changed files with 8 additions and 10 deletions

View File

@ -414,3 +414,11 @@ fn refcell_replace_borrows() {
let _b = x.borrow();
x.replace(1);
}
#[test]
fn refcell_format() {
let name = RefCell::new("rust");
let what = RefCell::new("rocks");
let msg = format!("{name} {}", &*what.borrow(), name = &*name.borrow());
assert_eq!(msg, "rust rocks".to_string());
}

View File

@ -1,10 +0,0 @@
// run-pass
use std::cell::RefCell;
pub fn main() {
let name = RefCell::new("rust");
let what = RefCell::new("rocks");
let msg = format!("{name} {}", &*what.borrow(), name=&*name.borrow());
assert_eq!(msg, "rust rocks".to_string());
}