1
use super::*;
2

            
3
#[test]
4
1
fn an_opaque_cell_nested_in_a_list_is_found() {
5
1
    let nested = EvalValue::List(vec![
6
1
        EvalValue::I32(1),
7
1
        EvalValue::List(vec![EvalValue::Opaque]),
8
1
    ]);
9
1
    assert!(has_opaque(&nested));
10
1
    assert!(!has_opaque(&EvalValue::List(vec![EvalValue::I32(1)])));
11
1
}
12

            
13
#[test]
14
1
fn readable_values_print_princ_style_and_join_with_a_space() {
15
1
    let list = EvalValue::List(vec![EvalValue::String("a b".into()), EvalValue::I32(2)]);
16
1
    assert_eq!(
17
1
        printed(vec![list, EvalValue::Symbol("X".into())]).as_deref(),
18
1
        Some("(a b 2) X")
19
    );
20
1
}
21

            
22
#[test]
23
1
fn an_unreadable_value_prints_nothing() {
24
1
    let nested = EvalValue::List(vec![EvalValue::Opaque]);
25
1
    assert_eq!(printed(vec![EvalValue::I32(1), nested]), None);
26
1
}
27

            
28
#[test]
29
1
fn a_closure_and_a_condition_print_in_their_opaque_forms() {
30
1
    assert_eq!(
31
1
        printed(vec![
32
1
            EvalValue::Closure { site: Some(3) },
33
1
            EvalValue::Closure { site: None },
34
1
            EvalValue::Condition
35
1
        ])
36
1
        .as_deref(),
37
1
        Some("#<closure:3> #<closure> #<condition>")
38
    );
39
1
}