dots2/.antidote/tests/test_cmd_bundle.md

1.5 KiB

antidote bundle helper tests

Setup

% source ./tests/_setup.zsh
% source ./antidote.zsh
%

Test bundle command

Many 'bundle' tests could just as well just be 'script' tests, so we rely on 'test_script.md' to find scripting issues and use this to test actual bundling, or things not handled by 'antidote script'. You can think of 'antidote script' as handling a single bundle, and 'antidote bundle' handling them in bulk.

General

% # antidote bundle
%
% antidote bundle <$ZDOTDIR/.zsh_plugins.txt >$ZDOTDIR/.zsh_plugins.zsh
% cat $ZDOTDIR/.zsh_plugins.zsh | subenv  #=> --file testdata/.zsh_plugins.zsh
%

Multiple ways to call bundle

Test |piping, <redirection, and --args

% zstyle ':antidote:bundle' use-friendly-names off
% ANTIDOTE_HOME=$HOME/.cache/antibody
% antidote bundle foo/bar | subenv ANTIDOTE_HOME  #=> --file testdata/script-foobar.zsh
% echo 'foo/bar' | antidote bundle | subenv ANTIDOTE_HOME  #=> --file testdata/script-foobar.zsh
% echo 'foo/bar' >$ZDOTDIR/.zsh_plugins_simple.txt
% antidote bundle <$ZDOTDIR/.zsh_plugins_simple.txt | subenv ANTIDOTE_HOME  #=> --file testdata/script-foobar.zsh
% zstyle ':antidote:bundle' use-friendly-names on
% ANTIDOTE_HOME=$HOME/.cache/antidote
%

Fails

% echo "foo/bar\nfoo/baz kind:whoops" | antidote bundle 2>&1 | subenv ANTIDOTE_HOME
antidote: error: unexpected kind value: 'whoops'
fpath+=( $ANTIDOTE_HOME/foo/bar )
source $ANTIDOTE_HOME/foo/bar/bar.plugin.zsh
%

Teardown

% t_teardown
%