File: test_cells.rs

package info (click to toggle)
rust-borsh 1.5.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,808 kB
  • sloc: makefile: 2
file content (13 lines) | stat: -rw-r--r-- 301 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
use alloc::string::ToString;

#[test]
fn test_ref_cell_try_borrow_error() {
    let rcell = core::cell::RefCell::new("str");

    let _active_borrow = rcell.try_borrow_mut().unwrap();

    assert_eq!(
        borsh::to_vec(&rcell).unwrap_err().to_string(),
        "already mutably borrowed"
    );
}