diff options
| author | Kivooeo <Kivooeo123@gmail.com> | 2025-07-01 18:24:12 +0500 | 
|---|---|---|
| committer | Kivooeo <Kivooeo123@gmail.com> | 2025-07-05 00:45:24 +0500 | 
| commit | b28806da237176468ab2afae42b51fe43ad416e6 (patch) | |
| tree | f0d5298f2f64415993c0456faf966d55e4b677e0 /tests/ui/std/fs-nul-byte-paths.rs | |
| parent | 986f1c9b692665d4e7388062b8d8536acb0c99fd (diff) | |
| download | rust-b28806da237176468ab2afae42b51fe43ad416e6.tar.gz rust-b28806da237176468ab2afae42b51fe43ad416e6.zip | |
cleaned up some tests
Diffstat (limited to 'tests/ui/std/fs-nul-byte-paths.rs')
| -rw-r--r-- | tests/ui/std/fs-nul-byte-paths.rs | 20 | 
1 files changed, 13 insertions, 7 deletions
| diff --git a/tests/ui/std/fs-nul-byte-paths.rs b/tests/ui/std/fs-nul-byte-paths.rs index 5c37980127d..79012362347 100644 --- a/tests/ui/std/fs-nul-byte-paths.rs +++ b/tests/ui/std/fs-nul-byte-paths.rs @@ -1,18 +1,22 @@ -//@ run-pass +//! Test that `std::fs` functions properly reject paths containing NUL bytes. +//@ run-pass #![allow(deprecated)] //@ ignore-wasm32 no cwd //@ ignore-sgx no files -use std::fs; -use std::io; +use std::{fs, io}; fn assert_invalid_input<T>(on: &str, result: io::Result<T>) { fn inner(on: &str, result: io::Result<()>) { match result { Ok(()) => panic!("{} didn't return an error on a path with NUL", on), - Err(e) => assert!(e.kind() == io::ErrorKind::InvalidInput, - "{} returned a strange {:?} on a path with NUL", on, e.kind()), + Err(e) => assert!( + e.kind() == io::ErrorKind::InvalidInput, + "{} returned a strange {:?} on a path with NUL", + on, + e.kind() + ), } } inner(on, result.map(drop)) @@ -43,6 +47,8 @@ fn main() { assert_invalid_input("remove_dir", fs::remove_dir("\0")); assert_invalid_input("remove_dir_all", fs::remove_dir_all("\0")); assert_invalid_input("read_dir", fs::read_dir("\0")); - assert_invalid_input("set_permissions", - fs::set_permissions("\0", fs::metadata(".").unwrap().permissions())); + assert_invalid_input( + "set_permissions", + fs::set_permissions("\0", fs::metadata(".").unwrap().permissions()), + ); } | 
