std_macro_extensions/arc/
cfg.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#[test]
fn test_arc_num() {
    use crate::*;
    static NUM: i32 = 1;
    let num_arc: Arc<i32> = arc!(NUM);
    let num: i32 = num_arc.as_ref().clone();
    assert_eq!(num_arc, Arc::new(NUM));
    assert_eq!(num, NUM)
}

#[test]
fn test_arc_str() {
    use crate::*;
    static STR: &str = "test";
    let str_arc: Arc<&str> = arc!(STR);
    let tmp_str: &str = str_arc.as_ref();
    assert_eq!(str_arc, Arc::new(STR));
    assert_eq!(tmp_str, STR)
}

#[test]
fn test_arc_string() {
    use crate::*;
    static STR: &str = "test";
    let string_from_str: String = STR.to_string();
    let string_arc: Arc<String> = arc!(string_from_str.clone());
    let string: String = string_arc.as_ref().clone();
    assert_eq!(string_arc, Arc::new(string_from_str.clone()));
    assert_eq!(string, string_from_str.clone())
}