diff --git a/doc/zsdoc/zinit-autoload.zsh.adoc b/doc/zsdoc/zinit-autoload.zsh.adoc index efbc088fd..afcd46283 100644 --- a/doc/zsdoc/zinit-autoload.zsh.adoc +++ b/doc/zsdoc/zinit-autoload.zsh.adoc @@ -471,7 +471,6 @@ Has 111 line(s). Calls functions: |-- .zinit-prompt |-- .zinit-run-delete-hooks |   `-- zinit-side.zsh/.zinit-countdown - |-- zinit-side.zsh/.zinit-compute-ice |-- zinit.zsh/+zi-log |-- zinit.zsh/.zinit-any-to-user-plugin `-- zinit.zsh/zinit diff --git a/doc/zsdoc/zinit-side.zsh.adoc b/doc/zsdoc/zinit-side.zsh.adoc index 70fe0fe88..7f6ecde01 100644 --- a/doc/zsdoc/zinit-side.zsh.adoc +++ b/doc/zsdoc/zinit-side.zsh.adoc @@ -116,7 +116,6 @@ Uses feature(s): _setopt_ Called by: - zinit-autoload.zsh/.zinit-delete zinit-autoload.zsh/.zinit-edit zinit-autoload.zsh/.zinit-recall zinit-autoload.zsh/.zinit-update-or-status-snippet diff --git a/tests/_support/bootstrap b/tests/_support/bootstrap index bad2f093f..121ef0e9d 100755 --- a/tests/_support/bootstrap +++ b/tests/_support/bootstrap @@ -1,3 +1,8 @@ +#!/usr/bin/env zsh + +# emulate -L zsh +# setopt no_global_rcs no_rcs no_aliases extended_glob null_glob + emulate zsh setopt no_global_rcs no_rcs no_aliases extended_glob @@ -20,17 +25,16 @@ if [[ ! -d ${TMP_ZUNIT} ]]; then fi typeset -gx zi_test_dir="${TMP_ZUNIT}" -typeset -gxAUH ZINIT -# DEBUG 'true' +typeset -gxAUH ZINIT=() ZINIT+=( - BIN_DIR ${zi_test_dir}/zinit.git - COMPLETIONS_DIR ${zi_test_dir}/completions SNIPPETS_DIR ${zi_test_dir}/snippets - HOME_DIR ${zi_test_dir} PLUGINS_DIR ${zi_test_dir}/plugins - ZCOMPDUMP_PATH ${zi_test_dir}/zcompdump ZPFX ${zi_test_dir}/polaris - POLARIS ${zi_test_dir}/polaris + BIN_DIR "${zi_test_dir}/zinit.git" + COMPLETIONS_DIR "${zi_test_dir}/completions" SNIPPETS_DIR "${zi_test_dir}/snippets" + HOME_DIR "${zi_test_dir}" PLUGINS_DIR "${zi_test_dir}/plugins" + ZCOMPDUMP_PATH "${zi_test_dir}/zcompdump" ZPFX "${zi_test_dir}/polaris" + POLARIS "${zi_test_dir}/polaris" ) typeset -gxH ZPFX= -ZPFX="$zi_test_dir"/polaris +ZPFX="${zi_test_dir}/polaris" command git diff > ${ZINIT[HOME_DIR]}/unstaged.diff # info 'creating test env' @@ -49,7 +53,7 @@ fi if [[ -s $ZINIT[HOME_DIR]/unstaged.diff ]]; then ( - git -C $ZINIT[BIN_DIR] apply $ZINIT[HOME_DIR]/unstaged.diff && \ + git -C "${ZINIT[BIN_DIR]}" apply "${ZINIT[HOME_DIR]}/unstaged.diff" && \ chmod g-rwX "${ZINIT[HOME_DIR]}" && \ zcompile "${ZINIT[BIN_DIR]}/zinit.zsh" >/dev/null ) >/dev/null @@ -57,15 +61,16 @@ fi (( $? != 0 )) && { error "Unable to copy ${GIT_REPO} to ${TMP_ZUNIT}" >&2; exit 1 } hash -f -builtin hash -d zinit=$zi_test_dir -builtin hash -d zpfx=$zi_test_dir/polaris -builtin hash -d plugins=$zi_test_dir/plugins -source $zi_test_dir/zinit.git/zinit.zsh +builtin hash -d zinit="${zi_test_dir}" +builtin hash -d zpfx="${zi_test_dir}/polaris" +builtin hash -d plugins="${zi_test_dir}/plugins" +source "${zi_test_dir}/zinit.git/zinit.zsh" (( $? != 0 )) && { error "Unable to source zinit" >&2; exit 1 } hash -f -builtin hash -d zinit=$zi_test_dir -builtin hash -d zpfx=$zi_test_dir/polaris -builtin hash -d plugins=$zi_test_dir/plugins +builtin hash -d zinit="${zi_test_dir}" +builtin hash -d zpfx="${zi_test_dir}/polaris" +builtin hash -d plugins="${zi_test_dir}/plugins" + { zinit for \ @zdharma-continuum/zinit-annex-bin-gem-node \ @@ -74,5 +79,4 @@ builtin hash -d plugins=$zi_test_dir/plugins @zdharma-continuum/zinit-annex-linkman }>/dev/null -+zi-log "{m} loaded $annex dependencies" -zinit zstatus +zinit zstatus \ No newline at end of file diff --git a/tests/gh-r.zunit b/tests/gh-r.zunit index 745f04f47..1dd0e1f54 100755 --- a/tests/gh-r.zunit +++ b/tests/gh-r.zunit @@ -1,38 +1,13 @@ #!/usr/bin/env zunit @setup { - load "${PWD}/tests/_support/annex_test_assertions" - HOME="$zi_test_dir" # Stops programs creating directories in user home - typeset -gx ZBIN="$zi_test_dir/polaris/bin" os_type="${OSTYPE//[0-9\.]*/}" - [[ ! -d $ZBIN ]] && mkdir -p "$ZBIN" - zinit default-ice --quiet from'gh-r' lbin'!' null + load "${PWD}/tests/_support/annex_test_assertions" + HOME="$zi_test_dir" # Stops programs creating directories in user home + typeset -gx ZBIN="$zi_test_dir/polaris/bin" os_type="${OSTYPE//[0-9\.]*/}" + [[ ! -d $ZBIN ]] && mkdir -p "$ZBIN" + zinit default-ice --quiet from'gh-r' lbin'!' null } -# @test 'atmos' { Universal Tool for DevOps and Cloud Automation (works with terraform, helm, helmfile, etc) -# skip 'null' -# run zinit for lbin'!* -> atmos' @cloudposse/atmos; assert $state equals 0 -# local atmos="$ZBIN/atmos"; assert "$atmos" is_executable -# $atmos version; assert $state equals 0 -# } -# @test 'bit' { A tool for composable software development -# skip 'skip bit test due to gh-r version bug' -# run zinit lbin'!bit* -> bit' for @teambit/bit; assert $state equals 0 -# local bit="$ZBIN/bit"; assert "$bit" is_executable -# $bit --version; assert $state equals 0 -# } -# @test 'neovim::appimage' { # Vim-fork focused on extensibility and usability -# skip 'null' -# run zinit bpick'*appimage*' id-as'neovim/appimage' for neovim/neovim -# assert $state equals 0; assert $output contains 'nvim.appimage' -# assert "$ZINIT[PLUGINS_DIR]/neovim---appimage/nvim.appimage" is_file -# } -# @test 'neovim::binary' { # Vim-fork focused on extensibility and usability -# skip 'null' -# run zinit lbin'!**/nvim' id-as'neovim/binary' for neovim/neovim; assert $state equals 0; assert $output does_not_contain 'appimage' -# local nvim="$ZBIN/nvim"; assert "$nvim" is_executable -# $nvim --version; assert $state equals 0 -# } - @test 'act' { # Run your GitHub Actions locally run zinit for @nektos/act; assert $state equals 0 local act="$ZBIN/act"; assert "$act" is_executable @@ -575,22 +550,38 @@ run "$mdbook" --version; assert $state equals 127; assert $output contains 'no such file or directory' } +@test 'mdbook-lbin' { # Create book from markdown files. Like Gitbook but implemented in Rust + run zinit for @rust-lang/mdBook; assert $state equals 0 + local mdbook="$ZBIN/mdbook"; assert "$mdbook" is_executable + run "$mdbook" --version; assert $state equals 0 + run file "$mdbook"; assert $output contains 'executable' + zinit delete --yes rust-lang/mdBook; + run "$mdbook" --version; assert $state equals 127; assert $output contains 'no such file or directory' +} @test 'mdbook-sbin' { # Create book from markdown files. Like Gitbook but implemented in Rust load_bin_gem_node - local mdbook="$ZBIN/mdbook"; + run zinit from'gh-r' sbin"mdbook" for @rust-lang/mdBook; assert $state equals 0 + local mdbook="$ZBIN/mdbook"; assert "$mdbook" is_executable + run "$mdbook" --version; assert $state equals 0 + run file "$mdbook"; assert $output contains 'zsh script'; assert $output contains 'ASCII text' + zinit delete --yes rust-lang/mdBook; assert $state equals 0 + run "$mdbook" --version; assert $state equals 127; assert $output contains 'no such file or directory' +# @test 'mdbook-sbin' { # Create book from markdown files. Like Gitbook but implemented in Rust +# load_bin_gem_node +# local mdbook="$ZBIN/mdbook"; - run zinit from'gh-r' sbin"mdbook" for @rust-lang/mdBook; assert $state equals 0 assert "$mdbook" is_executable +# run zinit from'gh-r' sbin"mdbook" for @rust-lang/mdBook; assert $state equals 0 assert "$mdbook" is_executable - run "$mdbook" --version; assert $state equals 0 +# run "$mdbook" --version; assert $state equals 0 - run command file "$(command realpath ${mdbook})"; - assert $output contains 'zsh script'; assert $output contains 'ASCII text' +# run command file "$(command realpath ${mdbook})"; +# assert $output contains 'zsh script'; assert $output contains 'ASCII text' - run zinit delete --yes rust-lang/mdBook; assert $state equals 0 +# run zinit delete --yes rust-lang/mdBook; assert $state equals 0 - run "$mdbook" --version; - assert $state equals 127; assert $output contains 'no such file or directory' -} +# run "$mdbook" --version; +# assert $state equals 127; assert $output contains 'no such file or directory' +# } @test 'mdcat' { # cat for markdown run zinit for @swsnr/mdcat; assert $state equals 0 local mdcat="$ZBIN/mdcat"; assert "$mdcat" is_executable @@ -885,4 +876,32 @@ run $zoxide --version; assert $state equals 0 } +#============= +# Flaky Tests +#============= +# @test 'atmos' { Universal Tool for DevOps and Cloud Automation (works with terraform, helm, helmfile, etc) +# skip 'null' +# run zinit for lbin'!* -> atmos' @cloudposse/atmos; assert $state equals 0 +# local atmos="$ZBIN/atmos"; assert "$atmos" is_executable +# $atmos version; assert $state equals 0 +# } +# @test 'bit' { A tool for composable software development +# skip 'skip bit test due to gh-r version bug' +# run zinit lbin'!bit* -> bit' for @teambit/bit; assert $state equals 0 +# local bit="$ZBIN/bit"; assert "$bit" is_executable +# $bit --version; assert $state equals 0 +# } +# @test 'neovim::appimage' { # Vim-fork focused on extensibility and usability +# skip 'null' +# run zinit bpick'*appimage*' id-as'neovim/appimage' for neovim/neovim +# assert $state equals 0; assert $output contains 'nvim.appimage' +# assert "$ZINIT[PLUGINS_DIR]/neovim---appimage/nvim.appimage" is_file +# } +# @test 'neovim::binary' { # Vim-fork focused on extensibility and usability +# skip 'null' +# run zinit lbin'!**/nvim' id-as'neovim/binary' for neovim/neovim; assert $state equals 0; assert $output does_not_contain 'appimage' +# local nvim="$ZBIN/nvim"; assert "$nvim" is_executable +# $nvim --version; assert $state equals 0 +# } + # vim:ft=zsh:sw=2:sts=2:et:foldmarker={,}:foldmethod=marker