about summary refs log tree commit diff
path: root/compiler/rustc_metadata/src/dynamic_lib/tests.rs
blob: 7090bbf61c794747cf0d57d9f54da91c77069733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::*;

#[test]
fn test_errors_do_not_crash() {
    use std::path::Path;

    if !cfg!(unix) {
        return;
    }

    // Open /dev/null as a library to get an error, and make sure
    // that only causes an error, and not a crash.
    let path = Path::new("/dev/null");
    match DynamicLibrary::open(&path) {
        Err(_) => {}
        Ok(_) => panic!("Successfully opened the empty library."),
    }
}