From efb336a23b65a9a2d56889396b13c1757bdaf354 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Sun, 29 Dec 2019 14:58:33 -0300 Subject: Initial commit --- .../spacefish/tests/__sf_section_elixir.test.fish | 110 +++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .config/fisher/github.com/matchai/spacefish/tests/__sf_section_elixir.test.fish (limited to '.config/fisher/github.com/matchai/spacefish/tests/__sf_section_elixir.test.fish') diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_elixir.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_elixir.test.fish new file mode 100644 index 00000000..5c411f23 --- /dev/null +++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_elixir.test.fish @@ -0,0 +1,110 @@ +source $DIRNAME/spacefish_test_setup.fish + +function setup + spacefish_test_setup + mock elixir -v 0 "echo \"Erlang/OTP 21 [erts-10.3.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace] +Elixir 1.8.1 (compiled with Erlang/OTP 21)\"" + set -x ELIXIR_VERSION 1.8.1 + mkdir -p /tmp/tmp-spacefish + cd /tmp/tmp-spacefish +end + +function teardown + rm -rf /tmp/tmp-spacefish +end + +test "Prints section when mix.exs is present" + ( + touch /tmp/tmp-spacefish/mix.exs + + set_color --bold + echo -n "via " + set_color normal + set_color --bold magenta + echo -n "馃挧 v1.8.1" + set_color normal + set_color --bold + echo -n " " + set_color normal + ) = (__sf_section_elixir) +end + +test "Prints section when a *.ex file is present" + ( + touch /tmp/tmp-spacefish/testfile.ex + + set_color --bold + echo -n "via " + set_color normal + set_color --bold magenta + echo -n "馃挧 v1.8.1" + set_color normal + set_color --bold + echo -n " " + set_color normal + ) = (__sf_section_elixir) +end + +test "Doesn't print the section when mix.exs and *.ex aren't present" + () = (__sf_section_elixir) +end + +test "Changing SPACEFISH_ELIXIR_SYMBOL changes the displayed character" + ( + touch /tmp/tmp-spacefish/mix.exs + set SPACEFISH_ELIXIR_SYMBOL "路 " + + set_color --bold + echo -n "via " + set_color normal + set_color --bold magenta + echo -n "路 v1.8.1" + set_color normal + set_color --bold + echo -n " " + set_color normal + ) = (__sf_section_elixir) +end + +test "Changing SPACEFISH_ELIXIR_PREFIX changes the character prefix" + ( + touch /tmp/tmp-spacefish/mix.exs + set sf_exit_code 0 + set SPACEFISH_ELIXIR_PREFIX 路 + + set_color --bold + echo -n "路" + set_color normal + set_color --bold magenta + echo -n "馃挧 v1.8.1" + set_color normal + set_color --bold + echo -n " " + set_color normal + ) = (__sf_section_elixir) +end + +test "Changing SPACEFISH_ELIXIR_SUFFIX changes the character suffix" + ( + touch /tmp/tmp-spacefish/mix.exs + set sf_exit_code 0 + set SPACEFISH_ELIXIR_SUFFIX 路 + + set_color --bold + echo -n "via " + set_color normal + set_color --bold magenta + echo -n "馃挧 v1.8.1" + set_color normal + set_color --bold + echo -n "路" + set_color normal + ) = (__sf_section_elixir) +end + +test "doesn't display the section when SPACEFISH_ELIXIR_SHOW is set to \"false\"" + ( + touch /tmp/tmp-spacefish/mix.exs + set SPACEFISH_ELIXIR_SHOW false + ) = (__sf_section_elixir) +end -- cgit v1.2.3