]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_metadata/src/dynamic_lib/tests.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / compiler / rustc_metadata / src / dynamic_lib / tests.rs
1 use super::*;
2
3 #[test]
4 fn test_errors_do_not_crash() {
5 use std::path::Path;
6
7 if !cfg!(unix) {
8 return;
9 }
10
11 // Open /dev/null as a library to get an error, and make sure
12 // that only causes an error, and not a crash.
13 let path = Path::new("/dev/null");
14 match DynamicLibrary::open(&path) {
15 Err(_) => {}
16 Ok(_) => panic!("Successfully opened the empty library."),
17 }
18 }