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' ", };