summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_julia.test.fish
blob: 941212b237ce5db836de0761666e43a2ad1a213c (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
source $DIRNAME/spacefish_test_setup.fish

function setup
    spacefish_test_setup
    mock julia --version 0 "echo \"julia version 1.0.1\""
    mkdir -p /tmp/tmp-spacefish
    cd /tmp/tmp-spacefish
end

function teardown
    rm -rf /tmp/tmp-spacefish
end

test "Prints section when julia is installed and pwd has *.jl file(s)"
	(
		touch some-julia-file.jl

		set_color --bold
		echo -n "is "
		set_color normal
		set_color --bold green
		echo -n "ஃ v1.0.1"
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_julia)
end

test "Changing SPACEFISH_JULIA_SYMBOL changes the displayed character"
	(
		set SPACEFISH_JULIA_SYMBOL "· "
		touch some-julia-file.jl

		set_color --bold
		echo -n "is "
		set_color normal
		set_color --bold green
		echo -n "· v1.0.1"
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_julia)
end

test "Changing SPACEFISH_JULIA_PREFIX changes the character prefix"
	(
		set SPACEFISH_JULIA_PREFIX ·
		touch some-julia-file.jl

		set_color --bold
		echo -n "·"
		set_color normal
		set_color --bold green
		echo -n "ஃ v1.0.1"
		set_color normal
		set_color --bold
		echo -n " "
		set_color normal
	) = (__sf_section_julia)
end

test "Changing SPACEFISH_JULIA_SUFFIX changes the character suffix"
	(
		set SPACEFISH_JULIA_SUFFIX ·
		touch some-julia-file.jl

		set_color --bold
		echo -n "is "
		set_color normal
		set_color --bold green
		echo -n "ஃ v1.0.1"
		set_color normal
		set_color --bold
		echo -n "·"
		set_color normal
	) = (__sf_section_julia)
end


# Negative
test "Doesn't display section when SPACEFISH_JULIA_SHOW is set to 'false'"
	(
		set -g SPACEFISH_JULIA_SHOW false
		touch some-julia-file.jl

	) = (__sf_section_julia)
end

test "Doesn't display section when pwd has no *.jl file"
	() = (__sf_section_julia)
end