summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCasey Rodarmor <casey@rodarmor.com>2024-01-26 13:18:51 -0800
committerGitHub <noreply@github.com>2024-01-26 21:18:51 +0000
commitd55b5c2bdd396e9d2e05b01f62ea684c33dffcf5 (patch)
tree0e3bc9e5df595fffffd719d2575491ae2db7a8d9
parent5a36e685e59fe1f3d891acdafe61e177033b6e78 (diff)
Skip write_error test if running as root (#1881)
-rw-r--r--tests/fmt.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/fmt.rs b/tests/fmt.rs
index 3afde9c4..3ad46f38 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' ",
};