# ── setup.sh : reversible ~/.zshenv cutover (sandbox HOME, never touches live) ─
() {
local sand; sand="$(mktemp -d)"
print 'echo OLD' > "$sand/.zshrc"
HOME="$sand" bash "$DOTFILES/scripts/setup.sh" --link >/dev/null 2>&1
assert_contains "zshenv exports ZDOTDIR" "$(<"$sand/.zshenv")" 'export ZDOTDIR='
assert_ok "old .zshrc backed up" bash -c "ls $sand/.dotfiles-backup-*/.zshrc >/dev/null 2>&1"
assert_eq "old .zshrc untouched" "echo OLD" "$(<"$sand/.zshrc")"
HOME="$sand" bash "$DOTFILES/scripts/setup.sh" --revert >/dev/null 2>&1
assert_ok "revert removes zshenv block" bash -c "[[ ! -f $sand/.zshenv ]]"
rm -rf "$sand"
}