summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_conda.test.fish
blob: b63268ab5812e2df56c24cfd11518f1ed8a62700 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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