-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow zinit to be run from non-interactive scripts (#227)
* maint: Ignore .idea folder Co-authored-by: Philipp Schmitt <pschmitt@users.noreply.github.com> * fix: Don't escape exclamation marks in hook keys Exclamation marks (per default) get escaped in interactive mode, but not in non-interactive modes. In this case it meant that zinit would not find any hooks which implements the ices when running in non-interactive mode (e.g. in a script). This in turn would NOT result in errors but would just silently not execute any of the ices which of course would be a bad thing(tm). #199 has the details... Closes: #199 * fix: Ignore errors if cp cannot copy .zwc files This would otherwise bubble up as a hook failure and further up as a zinit call failure * fix: Add pick ice now that the compile hook is run After the fix, the compile hook is now run and would fail without this information. IN addition, only files starting with _ are linked into the completion folder. * fix: Fix docker-buildx gh-r test now that atclone ice is run * maint: Add basic tests for cp/mv/atclone/make ices zunit runs tests non-interactively and these tests fail without the fix in this branch. Co-authored-by: Philipp Schmitt <pschmitt@users.noreply.github.com>
- Loading branch information
Showing
10 changed files
with
111 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,4 @@ txt/ | |
zmodules/ | ||
tests/_output/ | ||
tests/_support/zunit/ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env zunit | ||
|
||
@setup { | ||
ZPLUGINS=$ZINIT[PLUGINS_DIR] | ||
|
||
function _zunit_assert_not_exists() { | ||
local pathname=$1 filepath | ||
|
||
# If filepath is relative, prepend the test directory | ||
if [[ "${pathname:0:1}" != "/" ]]; then | ||
filepath="$testdir/${pathname}" | ||
else | ||
filepath="$pathname" | ||
fi | ||
|
||
[[ ! -e "$filepath" ]] && return 0 | ||
|
||
echo "'$pathname' does exist" | ||
exit 1 | ||
} | ||
|
||
} | ||
|
||
@test 'mv' { | ||
run zinit as"null" id-as"test/mv" mv"readme.md -> mv.md" for zdharma-continuum/null | ||
assert $state equals 0 | ||
assert "$ZPLUGINS/test---mv/mv.md" is_file | ||
assert "$ZPLUGINS/test---mv/mv.md" is_file | ||
assert "$ZPLUGINS/test---mv/readme.md" not_exists | ||
} | ||
|
||
@test 'cp' { | ||
run zinit as"null" id-as"test/cp" cp"readme.md -> cp.md" for zdharma-continuum/null | ||
assert $state equals 0 | ||
assert "$ZPLUGINS/test---cp/cp.md" is_file | ||
assert "$ZPLUGINS/test---cp/cp.md" is_readable | ||
assert "$ZPLUGINS/test---cp/readme.md" is_file | ||
} | ||
|
||
@test 'atclone' { | ||
run zinit as"null" id-as"test/atclone" atclone"mv readme.md atclone.md" for zdharma-continuum/null | ||
assert $state equals 0 | ||
assert "$ZPLUGINS/test---atclone/atclone.md" is_file | ||
assert "$ZPLUGINS/test---atclone/atclone.md" is_readable | ||
assert "$ZPLUGINS/test---atclone/readme.md" not_exists | ||
} | ||
|
||
@test 'make' { | ||
run zinit as"null" id-as"test/make" atclone"printf 'all:\n\ttouch whatever\n' > Makefile" make"" for zdharma-continuum/null | ||
assert $state equals 0 | ||
assert "$ZPLUGINS/test---make/whatever" is_file | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters