Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Refactor: Simplify path handling in permission tests
Maximilian Roosb673b1e10891
diff --git a/tests/common/mod.rs b/tests/common/mod.rsindex af8169475..fbb32c8fb 100644--- a/tests/common/mod.rs+++ b/tests/common/mod.rs@@ -199,7 +199,10 @@ impl TestRepo {("SOURCE_DATE_EPOCH".to_string(), "1761609600".to_string()),// Disable git advice hints for stable output across versions("GIT_CONFIG_COUNT".to_string(), "1".to_string()),- ("GIT_CONFIG_KEY_0".to_string(), "advice.mergeConflict".to_string()),+ (+ "GIT_CONFIG_KEY_0".to_string(),+ "advice.mergeConflict".to_string(),+ ),("GIT_CONFIG_VALUE_0".to_string(), "false".to_string()),("WORKTRUNK_CONFIG_PATH".to_string(),diff --git a/tests/integration_tests/approval_pty.rs b/tests/integration_tests/approval_pty.rsindex 3d3f22265..ee92c1be2 100644--- a/tests/integration_tests/approval_pty.rs+++ b/tests/integration_tests/approval_pty.rs@@ -203,19 +203,19 @@ fn test_approval_prompt_permission_error() {use std::os::unix::fs::PermissionsExt;// Create the config file first- fs::write(&config_path, "# read-only config\n").unwrap();+ fs::write(config_path, "# read-only config\n").unwrap();// Make it read-only- let mut perms = fs::metadata(&config_path).unwrap().permissions();+ let mut perms = fs::metadata(config_path).unwrap().permissions();perms.set_mode(0o444); // Read-only- fs::set_permissions(&config_path, perms).unwrap();+ fs::set_permissions(config_path, perms).unwrap();// Test if permissions actually restrict us (skip if running as root)- if fs::write(&config_path, "test write").is_ok() {+ if fs::write(config_path, "test write").is_ok() {// Running as root - restore permissions and skip test- let mut perms = fs::metadata(&config_path).unwrap().permissions();+ let mut perms = fs::metadata(config_path).unwrap().permissions();perms.set_mode(0o644);- fs::set_permissions(&config_path, perms).unwrap();+ fs::set_permissions(config_path, perms).unwrap();eprintln!("Skipping permission test - running with elevated privileges");return;}