From d55b5c2bdd396e9d2e05b01f62ea684c33dffcf5 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 26 Jan 2024 13:18:51 -0800 Subject: [PATCH] Skip write_error test if running as root (#1881) --- tests/fmt.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/fmt.rs b/tests/fmt.rs index 3afde9c..3ad46f3 100644 --- a/tests/fmt.rs +++ b/tests/fmt.rs @@ -103,6 +103,13 @@ fn unstable_passed() { #[test] fn write_error() { + // skip this test if running as root, since root can write files even if + // permissions would otherwise forbid it + #[cfg(not(windows))] + if unsafe { libc::getuid() } == 0 { + return; + } + let tempdir = temptree! { justfile: "x := 'hello' ", };