1
//! Plan 0014 slice 3.3b (ISS-139): a null entity reference prints as nil.
2

            
3
use std::process::Command;
4

            
5
2
fn nms_stdout(source: &str) -> String {
6
2
    let out = Command::new(env!("CARGO_BIN_EXE_nms"))
7
2
        .args(["-e", source])
8
2
        .output()
9
2
        .expect("invoke nms");
10
2
    assert!(
11
2
        out.status.success(),
12
        "{}",
13
        String::from_utf8_lossy(&out.stderr)
14
    );
15
2
    String::from_utf8_lossy(&out.stdout).into_owned()
16
2
}
17

            
18
#[test]
19
1
fn a_condition_set_to_nil_prints_nil() {
20
1
    assert_eq!(
21
1
        nms_stdout(r#"(handler-case (error 'boom "m") (t (e) (setf e nil) e))"#),
22
1
        "nil\n"
23
    );
24
1
}
25

            
26
#[test]
27
1
fn a_live_condition_still_prints_as_an_entity() {
28
1
    assert_ne!(
29
1
        nms_stdout(r#"(handler-case (error 'boom "m") (t (e) e))"#),
30
1
        "nil\n"
31
    );
32
1
}