diff options
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/tests/__sf_section_conda.test.fish')
-rw-r--r-- | .config/fisher/github.com/matchai/spacefish/tests/__sf_section_conda.test.fish | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_conda.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_conda.test.fish new file mode 100644 index 00000000..b63268ab --- /dev/null +++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_conda.test.fish @@ -0,0 +1,79 @@ +source $DIRNAME/spacefish_test_setup.fish +set -l LOCAL_CONDA_VERSION 4.5.11 + +function setup + spacefish_test_setup + mock conda -V 0 "echo \"conda 4.5.11\"" + mkdir -p /tmp/tmp-spacefish + cd /tmp/tmp-spacefish +end + +function teardown + rm -rf /tmp/tmp-spacefish + if test "$CONDA_DEFAULT_ENV" + set -e CONDA_DEFAULT_ENV + end +end + +test "Prints section when conda is installed and CONDA_DEFAULT_ENV is set" + ( + set -g CONDA_DEFAULT_ENV some-env + + set_color --bold + echo -n "via " + set_color normal + set_color --bold blue + echo -n "🅒 v$LOCAL_CONDA_VERSION" + set_color normal + set_color --bold + echo -n " " + set_color normal + ) = (__sf_section_conda) +end + +test "Changing SPACEFISH_CONDA_SYMBOL changes the displayed character" + ( + set SPACEFISH_CONDA_SYMBOL "· " + set -g CONDA_DEFAULT_ENV some-env + + set_color --bold + echo -n "via " + set_color normal + set_color --bold blue + echo -n "· v$LOCAL_CONDA_VERSION" + set_color normal + set_color --bold + echo -n " " + set_color normal + ) = (__sf_section_conda) +end + +test "Changing SPACEFISH_CONDA_PREFIX changes the character prefix" + ( + set SPACEFISH_CONDA_PREFIX · + set -g CONDA_DEFAULT_ENV some-env + + set_color --bold + echo -n "·" + set_color normal + set_color --bold blue + echo -n "🅒 v$LOCAL_CONDA_VERSION" + set_color normal + set_color --bold + echo -n " " + set_color normal + ) = (__sf_section_conda) +end + + +# Negative +test "Doesn't display section when SPACEFISH_CONDA_SHOW is set to 'false'" + ( + set -g SPACEFISH_CONDA_SHOW false + set -g CONDA_DEFAULT_ENV some-env + ) = (__sf_section_conda) +end + +test "Doesn't display section when CONDA_DEFAULT_ENV is not set" + () = (__sf_section_conda) +end |