mirror of
https://github.com/zplug/zplug
synced 2026-03-07 06:31:48 +01:00
Remove double quotes from git_version() array expansion that caused version string matching to fail on zsh 5.9 (scalar join before glob match). Add command-level test suite (add, check, list, clean) with shared test helper for isolated ZPLUG_HOME setup.
44 lines
1012 B
Bash
44 lines
1012 B
Bash
#!/usr/bin/env zsh
|
|
|
|
source "$ZPLUG_ROOT/test/helper.zsh"
|
|
|
|
T_SUB "clean --force removes unmanaged repo directory" ((
|
|
zplugs=()
|
|
|
|
# Create an unmanaged repo directory (not in zplugs)
|
|
local orphan_dir="$ZPLUG_REPOS/orphan-user/orphan-plugin"
|
|
mkdir -p "$orphan_dir"
|
|
|
|
zplug clean --force 2>/dev/null
|
|
|
|
[[ ! -d "$orphan_dir" ]]
|
|
t_ok $? "unmanaged directory is removed"
|
|
))
|
|
|
|
T_SUB "clean --force does not remove managed repo" ((
|
|
zplugs=()
|
|
local repo="user/managed-plugin"
|
|
zplug "$repo"
|
|
|
|
# Create the managed repo directory
|
|
mkdir -p "$ZPLUG_REPOS/$repo"
|
|
|
|
zplug clean --force 2>/dev/null
|
|
|
|
t_directory "$ZPLUG_REPOS/$repo" "managed directory is preserved"
|
|
))
|
|
|
|
T_SUB "clean --force removes specified repo" ((
|
|
zplugs=()
|
|
local repo="user/to-remove"
|
|
zplug "$repo"
|
|
|
|
# Create the repo directory
|
|
mkdir -p "$ZPLUG_REPOS/$repo"
|
|
|
|
zplug clean --force "$repo" 2>/dev/null
|
|
|
|
[[ ! -d "$ZPLUG_REPOS/$repo" ]]
|
|
t_ok $? "specified directory is removed"
|
|
))
|