diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2025-01-26 06:15:58 +0000 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2025-01-26 06:17:12 +0000 |
| commit | 962ebf0a48436445cf300efc0fa552044f4ca19d (patch) | |
| tree | 33d315db7accf6e2545beb79bd8550b54ab6db98 /library/std/tests | |
| parent | 50522fad483ad86291db1871b396f9d54f0de6e7 (diff) | |
Windows: Test that deleting a running binary fails
Diffstat (limited to 'library/std/tests')
| -rw-r--r-- | library/std/tests/win_delete_self.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/std/tests/win_delete_self.rs b/library/std/tests/win_delete_self.rs new file mode 100644 index 00000000000..1c3ce4d710c --- /dev/null +++ b/library/std/tests/win_delete_self.rs @@ -0,0 +1,8 @@ +#![cfg(windows)] + +/// Attempting to delete a running binary should return an error on Windows. +#[test] +fn win_delete_self() { + let path = std::env::current_exe().unwrap(); + assert!(std::fs::remove_file(path).is_err()); +} |
