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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
use openat_ct as openat; use openat::{Dir}; #[test] fn dir_flags_builder_basic() { let dir = Dir::flags() .without(libc::O_CLOEXEC) .with(libc::O_NOFOLLOW) .open("src"); assert!(dir.is_ok()); } #[test] fn dir_flags_builder_reuse() { let dir_flags = Dir::flags().without(libc::O_CLOEXEC).with(libc::O_NOFOLLOW); let src_dir = dir_flags.open("src"); let tests_dir = dir_flags.open("tests"); assert!(src_dir.is_ok()); assert!(tests_dir.is_ok()); } #[test] fn method_flags_builder_basic() { let dir = Dir::open("src").unwrap(); let file = dir.without(libc::O_NOFOLLOW).open_file("dir.rs"); assert!(file.is_ok()); } #[test] fn method_flags_builder_reuse() { let dir = Dir::open("src").unwrap(); let dir_flags = dir.without(libc::O_NOFOLLOW); let file1 = dir_flags.open_file("dir.rs"); let file2 = dir_flags.open_file("builder.rs"); assert!(file1.is_ok()); assert!(file2.is_ok()); } #[test] fn method_flags_exported() { let dir = Dir::flags() .with(openat::O_PATH) .open("src"); assert!(dir.is_ok()); }