summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/tests
diff options
context:
space:
mode:
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/tests')
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish117
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_aws.test.fish89
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_char.test.fish88
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_conda.test.fish79
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dir.test.fish383
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_docker.test.fish218
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dotnet.test.fish195
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_elixir.test.fish110
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish51
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_git_status.test.fish129
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_golang.test.fish173
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_host.test.fish124
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_jobs.test.fish120
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_julia.test.fish93
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_kubecontext.test.fish119
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_line_sep.test.fish17
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_node.test.fish192
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_package.test.fish72
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_php.test.fish110
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_pyenv.test.fish159
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_rust.test.fish125
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_time.test.fish109
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_user.test.fish95
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_venv.test.fish50
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_section_vi_mode.test.fish144
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_util_git_branch.test.fish45
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_util_human_time.test.fish89
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_util_set_default.test.fish14
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/__sf_util_truncate_dir.test.fish28
-rwxr-xr-x.config/fisher/github.com/matchai/spacefish/tests/run.fish22
-rw-r--r--.config/fisher/github.com/matchai/spacefish/tests/spacefish_test_setup.fish14
31 files changed, 3373 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish
new file mode 100644
index 00000000..fc5ed29c
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_lib_section.test.fish
@@ -0,0 +1,117 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+test "Displays only the colored content when 2 arguments are passed"
+ (
+ set_color --bold
+ echo -n ""
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n ""
+ set_color normal
+ ) = (__sf_lib_section red "test content")
+end
+
+test "Displays the prefix, colored content and suffix when 4 arguments are passed"
+ (
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Displays the prefix if prefixes are enabled"
+ (
+ set SPACEFISH_PROMPT_PREFIXES_SHOW true
+
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Doesn't display the prefix if prefixes are disabled"
+ (
+ set SPACEFISH_PROMPT_PREFIXES_SHOW false
+
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Displays the suffix if suffixes are enabled"
+ (
+ set SPACEFISH_PROMPT_SUFFIXES_SHOW true
+
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ set_color --bold
+ echo -n "suffix"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Doesn't display the suffix if suffixes are disabled"
+ (
+ set SPACEFISH_PROMPT_SUFFIXES_SHOW false
+
+ set_color --bold
+ echo -n "prefix"
+ set_color normal
+ set_color --bold red
+ echo -n "test content"
+ set_color normal
+ ) = (__sf_lib_section red prefix "test content" suffix)
+end
+
+test "Only prints the prefix for the second consecutive section"
+ (
+ set sf_prompt_opened false
+
+ set_color --bold red
+ echo -n "test content 1"
+ set_color normal
+ set_color --bold
+ echo -n "suffix 1"
+ set_color normal
+
+ set_color --bold
+ echo -n "prefix 2"
+ set_color normal
+ set_color --bold red
+ echo -n "test content 2"
+ set_color normal
+ set_color --bold
+ echo -n "suffix 2"
+ set_color normal
+ ) = (
+ __sf_lib_section red "prefix 1" "test content 1" "suffix 1"
+ __sf_lib_section red "prefix 2" "test content 2" "suffix 2"
+ )
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_aws.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_aws.test.fish
new file mode 100644
index 00000000..17c5eb6c
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_aws.test.fish
@@ -0,0 +1,89 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock aws \* 0
+ set -g AWS_PROFILE user1
+end
+
+test "Prints section when AWS_PROFILE is set"
+ (
+ set_color --bold
+ echo -n "using "
+ set_color normal
+ set_color --bold ff8700
+ echo -n "☁️ user1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_aws)
+end
+
+test "Doesn't print the section when AWS_PROFILE isn't set"
+ (
+ set --erase AWS_PROFILE
+ ) = (__sf_section_aws)
+end
+
+test "Doesn't print the section when AWS_PROFILE is set to \"default\""
+ (
+ set AWS_PROFILE default
+ ) = (__sf_section_aws)
+end
+
+test "Changing SPACEFISH_AWS_SYMBOL changes the displayed character"
+ (
+ set SPACEFISH_AWS_SYMBOL "· "
+
+ set_color --bold
+ echo -n "using "
+ set_color normal
+ set_color --bold ff8700
+ echo -n "· user1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_aws)
+end
+
+test "Changing SPACEFISH_AWS_PREFIX changes the character prefix"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_AWS_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold ff8700
+ echo -n "☁️ user1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_aws)
+end
+
+test "Changing SPACEFISH_AWS_SUFFIX changes the character suffix"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_AWS_SUFFIX ·
+
+ set_color --bold
+ echo -n "using "
+ set_color normal
+ set_color --bold ff8700
+ echo -n "☁️ user1"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_aws)
+end
+
+test "doesn't display the section when SPACEFISH_AWS_SHOW is set to \"false\""
+ (
+ set SPACEFISH_AWS_SHOW false
+ ) = (__sf_section_aws)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_char.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_char.test.fish
new file mode 100644
index 00000000..8ebf76b8
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_char.test.fish
@@ -0,0 +1,88 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+test "Displays default char with status code 0"
+ (
+ set sf_exit_code 0
+
+ set_color --bold
+ echo -n ""
+ set_color normal
+ set_color --bold green
+ echo -n "➜"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_char)
+end
+
+test "Displays default char with status code 1"
+ (
+ set sf_exit_code 1
+
+ set_color --bold
+ echo -n ""
+ set_color normal
+ set_color --bold red
+ echo -n "➜"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_char)
+end
+
+test "Changing SPACEFISH_CHAR_SYMBOL changes the displayed character"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_CHAR_SYMBOL ·
+
+ set_color --bold
+ echo -n ""
+ set_color normal
+ set_color --bold green
+ echo -n "·"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_char)
+end
+
+test "Changing SPACEFISH_CHAR_PREFIX changes the character prefix"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_CHAR_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold green
+ echo -n "➜"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_char)
+end
+
+test "Changing SPACEFISH_CHAR_SYMBOL changes the character suffix"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_CHAR_SUFFIX ·
+
+ set_color --bold
+ echo -n ""
+ set_color normal
+ set_color --bold green
+ echo -n "➜"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_char)
+end
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
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dir.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dir.test.fish
new file mode 100644
index 00000000..676cadff
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dir.test.fish
@@ -0,0 +1,383 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mkdir -p ~/.tmp-spacefish/dir1/dir2
+ mkdir -p /tmp/tmp-spacefish/dir1/dir2/dir3
+ mkdir -p /tmp/tmp-spacefish/writeProtected
+ chmod 500 /tmp/tmp-spacefish/writeProtected
+ # disabling SPACEFISH_DIR_LOCK_SYMBOL to avoid breaking old tests
+ set SPACEFISH_DIR_LOCK_SHOW false
+end
+
+function teardown
+ rm -rf ~/.tmp-spacefish
+ rm -rf /tmp/tmp-spacefish
+end
+
+#
+# Home directory
+#
+
+test "Correctly truncates home directory"
+ (
+ cd ~
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "~"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Correctly truncates a home subdirectory"
+ (
+ cd ~/.tmp-spacefish/dir1/
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "~/.tmp-spacefish/dir1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Correctly truncates a deeply nested home subdirectory"
+ (
+ cd ~/.tmp-spacefish/dir1/dir2
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n ".tmp-spacefish/dir1/dir2"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+#
+# Root directory
+#
+
+test "Correctly truncates root directory"
+ (
+ cd /
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "/"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Correctly truncates a root subdirectory"
+ (
+ cd /usr
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "/usr"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Correctly truncates a deeply nested root subdirectory"
+ (
+ cd /tmp/tmp-spacefish/dir1/dir2
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "tmp-spacefish/dir1/dir2"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+#
+# Git directory
+#
+
+test "Correctly truncates the root of a git directory"
+ (
+ cd /tmp/tmp-spacefish
+ command git init >/dev/null
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "tmp-spacefish"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Correctly truncates a git subdirectory"
+ (
+ cd /tmp/tmp-spacefish
+ command git init >/dev/null
+ cd /tmp/tmp-spacefish/dir1
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "tmp-spacefish/dir1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Correctly truncates a deeply nested git subdirectory"
+ (
+ cd /tmp/tmp-spacefish
+ command git init >/dev/null
+ cd /tmp/tmp-spacefish/dir1/dir2/dir3
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "dir1/dir2/dir3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Correctly truncates the root of a git directory within another"
+ (
+ cd /tmp/tmp-spacefish
+ command git init >/dev/null
+
+ cd /tmp/tmp-spacefish/dir1
+ command git init >/dev/null
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "dir1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Doesn't throw an error when in a .git directory"
+ (
+ cd /tmp/tmp-spacefish
+ command git init >/dev/null
+
+ cd /tmp/tmp-spacefish/.git
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "tmp/tmp-spacefish/.git"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+
+#
+# Configuration
+#
+
+test "Doesn't show if SPACEFISH_DIR_SHOW is false"
+ (
+ set SPACEFISH_DIR_SHOW false
+ ) = (__sf_section_dir)
+end
+
+test "Changing SPACEFISH_DIR_PREFIX changes the dir prefix"
+ (
+ set SPACEFISH_DIR_PREFIX ·
+ cd ~
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold cyan
+ echo -n "~"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Changing SPACEFISH_DIR_SUFFIX changes the dir prefix"
+ (
+ set SPACEFISH_DIR_SUFFIX ·
+ cd ~
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "~"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+# SPACEFISH_DIR_TRUNC functionality is further tested in:
+# __sf_util_truncate_dir.test.fish
+test "Changing SPACEFISH_DIR_TRUNC changes the dir length"
+ (
+ set SPACEFISH_DIR_TRUNC 1
+ cd /tmp/tmp-spacefish/dir1/dir2/dir3
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "dir3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Disabling SPACEFISH_DIR_TRUNC_REPO stops repo dir truncation"
+ (
+ set SPACEFISH_DIR_TRUNC_REPO false
+ cd ~/.tmp-spacefish
+ command git init >/dev/null
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "~/.tmp-spacefish"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Changing SPACEFISH_DIR_COLOR changes the dir color"
+ (
+ set SPACEFISH_DIR_COLOR red
+ cd ~
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold red
+ echo -n "~"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+
+#
+# SPACEFISH_DIR_LOCK_SYMBOL
+#
+
+test "Shows DIR_LOCK_SYMBOL if in a dir with no write permissions and SPACEFISH_DIR_LOCK_SHOW is true"
+ (
+ cd /tmp/tmp-spacefish/writeProtected
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "tmp/tmp-spacefish/writeProtected"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Doesn't show DIR_LOCK_SYMBOL if SPACEFISH_DIR_LOCK_SHOW is false"
+ (
+ cd /tmp/tmp-spacefish/writeProtected
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "tmp/tmp-spacefish/writeProtected"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Doesn't show DIR_LOCK_SYMBOL if current directory is not write protected for this user"
+ (
+ cd ~
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "~"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
+
+test "Changing SPACEFISH_DIR_LOCK_SYMBOL changes the symbol"
+ (
+ set SPACEFISH_DIR_LOCK_SYMBOL "😀"
+ cd /tmp/tmp-spacefish/writeProtected
+
+ set_color --bold
+ echo -n "in "
+ set_color normal
+ set_color --bold cyan
+ echo -n "tmp/tmp-spacefish/writeProtected"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dir)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_docker.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_docker.test.fish
new file mode 100644
index 00000000..4321afc7
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_docker.test.fish
@@ -0,0 +1,218 @@
+source $DIRNAME/spacefish_test_setup.fish
+set -l LOCAL_DOCKER_VERSION 18.06.1
+
+function setup
+ spacefish_test_setup
+ mock docker version 0 "echo \"18.06.1\""
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+ if test "$COMPOSE_FILE"
+ set -e COMPOSE_FILE
+ end
+ if test "$DOCKER_MACHINE_NAME"
+ set -e DOCKER_MACHINE_NAME
+ end
+end
+
+test "Prints section when only Dockerfile is present"
+ (
+ touch Dockerfile
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Prints section when only docker-compose.yml is present"
+ (
+ touch docker-compose.yml
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Prints section when both Dockerfile and docker-compose.yml are present"
+ (
+ touch Dockerfile
+ touch docker-compose.yml
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Prints Docker section when COMPOSE_FILE is set and the $COMPOSE_FILE exists"
+ (
+ set -g COMPOSE_FILE /tmp/some-compose-file.yml
+ touch /tmp/some-compose-file.yml
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Prints section when only Dockerfile is present with DOCKER_MACHINE_NAME set"
+ (
+ rm /tmp/some-compose-file.yml
+ touch Dockerfile
+ set -g DOCKER_MACHINE_NAME some-machine-name
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Prints section when only docker-compose.yml is present with DOCKER_MACHINE_NAME set"
+ (
+ touch docker-compose.yml
+ set -g DOCKER_MACHINE_NAME some-machine-name
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Prints section when both Dockerfile and docker-compose.yml are present with DOCKER_MACHINE_NAME set"
+ (
+ touch Dockerfile
+ touch docker-compose.yml
+ set -g DOCKER_MACHINE_NAME some-machine-name
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Prints Docker section when COMPOSE_FILE is set with DOCKER_MACHINE_NAME set"
+ (
+ set -g COMPOSE_FILE /tmp/some-compose-file.yml
+ touch /tmp/some-compose-file.yml
+ set -g DOCKER_MACHINE_NAME some-machine-name
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION via $DOCKER_MACHINE_NAME"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Changing SPACEFISH_DOCKER_SYMBOL changes the displayed character"
+ (
+ rm /tmp/some-compose-file.yml
+ set SPACEFISH_DOCKER_SYMBOL "· "
+ touch Dockerfile
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold cyan
+ echo -n "· v$LOCAL_DOCKER_VERSION"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+test "Changing SPACEFISH_DOCKER_PREFIX changes the character prefix"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_DOCKER_PREFIX ·
+ touch Dockerfile
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐳 v$LOCAL_DOCKER_VERSION"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_docker)
+end
+
+
+# Negative
+test "Doesn't display section when SPACEFISH_DOCKER_SHOW is set to 'false'"
+ (
+ set SPACEFISH_DOCKER_SHOW false
+ touch Dockerfile
+
+ ) = (__sf_section_docker)
+end
+
+test "Doesn't print section if docker is not installed"
+ (
+ touch Dockerfile
+ mock docker version 127
+ ) = (__sf_section_docker)
+end
+
+# This case can be checked only by bringing down the docker deamon
+test "Doesn't print section if docker deamon is not running"
+ () = (__sf_section_docker)
+end
+
+test "Doesn't print section when not in a directory with Dockerfile or docker-compose.yml"
+ () = (__sf_section_docker)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dotnet.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dotnet.test.fish
new file mode 100644
index 00000000..f3277445
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_dotnet.test.fish
@@ -0,0 +1,195 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock dotnet --version 0 "echo \"2.1.403\""
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Prints nothing when required files are missing"
+ (
+ rm -f /tmp/tmp-spacefish/project.json
+ rm -f /tmp/tmp-spacefish/global.json
+ rm -f /tmp/tmp-spacefish/paket.dependencies
+ rm -f '/tmp/tmp-spacefish/*.sln'
+ rm -f '/tmp/tmp-spacefish/*.csproj'
+ rm -f '/tmp/tmp-spacefish/*.fsproj'
+ rm -f '/tmp/tmp-spacefish/*.xproj'
+ ) = (__sf_section_dotnet)
+end
+
+test "Prints section if project.json is present"
+ (
+ touch /tmp/tmp-spacefish/project.json
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Prints section if global.json is present"
+ (
+ touch /tmp/tmp-spacefish/global.json
+ set_color --bold
+
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Prints section if paket.dependencies is present"
+ (
+ touch /tmp/tmp-spacefish/paket.dependencies
+ set_color --bold
+
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Prints section if a .csproj file is present"
+ (
+ touch /tmp/tmp-spacefish/tmp.csproj
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Prints section if a .fsproj file is present"
+ (
+ touch /tmp/tmp-spacefish/tmp.fsproj
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Prints section if a .xproj file is present"
+ (
+ touch /tmp/tmp-spacefish/tmp.xproj
+ set_color --bold
+
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Prints section if a .sln file is present"
+ (
+ touch /tmp/tmp-spacefish/tmp.sln
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Changing SPACEFISH_DOTNET_SYMBOL changes the displayed character"
+ (
+ touch /tmp/tmp-spacefish/tmp.sln
+
+ set SPACEFISH_DOTNET_SYMBOL "· "
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n "· 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Changing SPACEFISH_DOTNET_PREFIX changes the character prefix"
+ (
+ touch /tmp/tmp-spacefish/tmp.sln
+ set sf_exit_code 0
+ set SPACEFISH_DOTNET_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Changing SPACEFISH_DOTNET_SUFFIX changes the character prefix"
+ (
+ touch /tmp/tmp-spacefish/tmp.sln
+ set sf_exit_code 0
+ set SPACEFISH_DOTNET_SUFFIX ·
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold af00d7
+ echo -n ".NET 2.1.403"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_dotnet)
+end
+
+test "Doesn't display .NET when SPACEFISH_DOTNET_SHOW is set to 'false'"
+ (
+ set SPACEFISH_DOTNET_SHOW false
+ ) = (__sf_section_dotnet)
+end
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
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish
new file mode 100644
index 00000000..b8559669
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_exit_code.test.fish
@@ -0,0 +1,51 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+test "Exit code not enabled by default"
+ (
+ set sf_exit_code 1
+ ) = (__sf_section_exit_code)
+end
+
+test "Enable exit-code, shows exit code upon fail"
+ (
+ set SPACEFISH_EXIT_CODE_SHOW true
+ set sf_exit_code 1
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n "✘1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_exit_code)
+end
+
+test "Hides exit code upon success"
+ (
+ set SPACEFISH_EXIT_CODE_SHOW true
+ set sf_exit_code 0
+ ) = (__sf_section_exit_code)
+end
+
+test "Color-changing exit code"
+ (
+ set SPACEFISH_EXIT_CODE_SHOW true
+ set SPACEFISH_EXIT_CODE_COLOR "purple"
+ set sf_exit_code 1
+
+ set_color --bold
+ set_color normal
+ set_color --bold purple
+ echo -n "✘1"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_exit_code)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_git_status.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_git_status.test.fish
new file mode 100644
index 00000000..91c6fd5d
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_git_status.test.fish
@@ -0,0 +1,129 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+ command git init >/dev/null
+ command git config --local user.email "test@example.com"
+ command git config --local user.name "Test User"
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Displays no status symbols in a clean repo"
+ () = (__sf_section_git_status)
+end
+
+test "Displays the correct symbol for untracked file"
+ (
+ touch testfile
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n " [?]"
+ set_color normal
+ set_color --bold
+ set_color normal
+ ) = (__sf_section_git_status)
+end
+
+test "Displays the correct symbol for added file"
+ (
+ touch testfile
+ command git add testfile
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n " [+]"
+ set_color normal
+ set_color --bold
+ set_color normal
+ ) = (__sf_section_git_status)
+end
+
+test "Displays the correct symbol for modified file"
+ (
+ touch testfile
+ command git add testfile
+ command git commit -m "Initial commit" --quiet
+ echo "modification" > testfile
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n " [!]"
+ set_color normal
+ set_color --bold
+ set_color normal
+ ) = (__sf_section_git_status)
+end
+
+test "Displays the correct symbol for renamed file"
+ (
+ touch testfile
+ command git add testfile
+ command git commit -m "Initial commit" --quiet
+ mv testfile newtestfile
+ command git add testfile newtestfile
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n " [»]"
+ set_color normal
+ set_color --bold
+ set_color normal
+ ) = (__sf_section_git_status)
+end
+
+test "Displays the correct symbol for deleted file"
+ (
+ touch testfile
+ command git add testfile
+ command git commit -m "Initial commit" --quiet
+ rm testfile
+ command git add testfile
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n " [✘]"
+ set_color normal
+ set_color --bold
+ set_color normal
+ ) = (__sf_section_git_status)
+end
+
+test "Displays the correct symbol for stashed file"
+ (
+ touch testfile
+ command git add testfile
+ command git commit -m "Initial commit" --quiet
+ echo "modification" > testfile
+ command git stash --quiet
+
+ set_color --bold
+ set_color normal
+ set_color --bold red
+ echo -n " [\$]"
+ set_color normal
+ set_color --bold
+ set_color normal
+ ) = (__sf_section_git_status)
+end
+
+test "Test config option SPACEFISH_GIT_STATUS_SHOW"
+ (
+ set -g SPACEFISH_GIT_STATUS_SHOW false
+ ) = (__sf_section_git_status)
+end
+
+# TODO: Get test dir into status *U*
+# TODO: Add test for ahead
+# TODO: Add test for behind
+# TODO: Add test for diverged
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_golang.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_golang.test.fish
new file mode 100644
index 00000000..bff4c704
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_golang.test.fish
@@ -0,0 +1,173 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock go version 0 "echo \"go version go1.10.3 darwin/amd64\""
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Prints section when Godeps is present"
+ (
+ mkdir /tmp/tmp-spacefish/Godeps
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Prints section when glide.yaml is present"
+ (
+ touch /tmp/tmp-spacefish/glide.yaml
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Prints section when Gopkg.yml is present"
+ (
+ touch /tmp/tmp-spacefish/Gopkg.yml
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Prints section when Gopkg.lock is present"
+ (
+ touch /tmp/tmp-spacefish/Gopkg.lock
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Prints section when go.mod is present"
+ (
+ touch /tmp/tmp-spacefish/go.mod
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Print section when using development version of golang"
+ (
+ mock go version 0 "echo go version devel +5efe9a8f11 Wed Jan 9 07:21:16 2019 +0000 darwin/amd64"
+ touch /tmp/tmp-spacefish/Gopkg.lock
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 devel:5efe9a8f11"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Doesn't print the section when golang files aren't present"
+ () = (__sf_section_golang)
+end
+
+test "Changing SPACEFISH_GOLANG_SYMBOL changes the displayed character"
+ (
+ touch /tmp/tmp-spacefish/Gopkg.lock
+ set SPACEFISH_GOLANG_SYMBOL "· "
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "· v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Changing SPACEFISH_GOLANG_PREFIX changes the character prefix"
+ (
+ touch /tmp/tmp-spacefish/Gopkg.lock
+ set sf_exit_code 0
+ set SPACEFISH_GOLANG_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "Changing SPACEFISH_GOLANG_SUFFIX changes the character suffix"
+ (
+ touch /tmp/tmp-spacefish/Gopkg.lock
+ set sf_exit_code 0
+ set SPACEFISH_GOLANG_SUFFIX ·
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold cyan
+ echo -n "🐹 v1.10.3"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_golang)
+end
+
+test "doesn't display the section when SPACEFISH_GOLANG_SHOW is set to \"false\""
+ (
+ touch /tmp/tmp-spacefish/Gopkg.lock
+ set SPACEFISH_GOLANG_SHOW false
+ ) = (__sf_section_golang)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_host.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_host.test.fish
new file mode 100644
index 00000000..a040226d
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_host.test.fish
@@ -0,0 +1,124 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+function teardown
+ if set -q SSH_CONNECTION;
+ set --erase SSH_CONNECTION
+ end
+end
+
+test "Correctly shows hostname upon SSH connection"
+ (
+ set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold green
+ echo -n (hostname)
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_host)
+end
+
+test "Displays user when SPACEFISH_HOST_SHOW is set to \"always\""
+ (
+ set SPACEFISH_HOST_SHOW always
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold blue
+ echo -n (hostname)
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_host)
+end
+
+test "Displays user when SPACEFISH_HOST_SHOW is set to \"always\", over SSH"
+ (
+ set SPACEFISH_HOST_SHOW always
+ set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold green
+ echo -n (hostname)
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_host)
+end
+
+test "doesn't display the section when SPACEFISH_HOST_SHOW is set to \"false\""
+ (
+ set SPACEFISH_HOST_SHOW false
+ ) = (__sf_section_host)
+end
+
+test "Displays hostname when set different from machine name, over SSH"
+ (
+ mock hostname \* 0 "echo \"spacefish\""
+ set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold green
+ echo -n "spacefish"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_host)
+end
+
+test "Doesn't display hostname by default, without SSH"
+ () = (__sf_section_host)
+end
+
+# Color testing; magenta = pass, red = failure.
+test "Test color, no SSH."
+ (
+ set SPACEFISH_HOST_COLOR "magenta" # No SSH connection. This should display.
+ set SPACEFISH_HOST_COLOR_SSH "red" # If red shows, test failed.
+ set SPACEFISH_HOST_SHOW always
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold "magenta"
+ echo -n (hostname)
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_host)
+end
+
+test "Test color, with SSH."
+ (
+ set SPACEFISH_HOST_COLOR "red" # If red shows, test failed.
+ set SPACEFISH_HOST_COLOR_SSH "magenta" # SSH connection exists. This should take precedence.
+ set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold "magenta"
+ echo -n (hostname)
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_host)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_jobs.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_jobs.test.fish
new file mode 100644
index 00000000..2ce12051
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_jobs.test.fish
@@ -0,0 +1,120 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+function teardown
+ killall sleep # Kill any previous background jobs
+end
+
+test "Test a single background job"
+ (
+ sleep 5 & # Background process
+
+ set_color --bold
+ set_color normal
+ set_color --bold blue
+ echo -n "✦"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_jobs)
+end
+
+test "Test with two background jobs"
+ (
+ sleep 5 & # Background process #1
+ sleep 5 & # Background process #2
+
+ set_color --bold
+ set_color normal
+ set_color --bold blue
+ echo -n "✦2"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_jobs)
+end
+
+test "Test with five background jobs"
+ (
+ sleep 5 & # Background process #1
+ sleep 5 & # Background process #2
+ sleep 5 & # Background process #3
+ sleep 5 & # Background process #4
+ sleep 5 & # Background process #5
+
+ set_color --bold
+ set_color normal
+ set_color --bold blue
+ echo -n "✦5"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_jobs)
+end
+
+test "Test with less than threshold of background jobs"
+ (
+ set SPACEFISH_JOBS_AMOUNT_THRESHOLD 4
+
+ sleep 5 & # Background process #1
+ sleep 5 & # Background process #2
+ sleep 5 & # Background process #3
+
+ set_color --bold
+ set_color normal
+ set_color --bold blue
+ echo -n "✦"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_jobs)
+end
+
+test "Test with equal threshold of background jobs"
+ (
+ set SPACEFISH_JOBS_AMOUNT_THRESHOLD 4
+
+ sleep 5 & # Background process #1
+ sleep 5 & # Background process #2
+ sleep 5 & # Background process #3
+ sleep 5 & # Background process #4
+
+ set_color --bold
+ set_color normal
+ set_color --bold blue
+ echo -n "✦"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_jobs)
+end
+
+test "Test with more than threshold of background jobs"
+ (
+ set SPACEFISH_JOBS_AMOUNT_THRESHOLD 4
+
+ sleep 5 & # Background process #1
+ sleep 5 & # Background process #2
+ sleep 5 & # Background process #3
+ sleep 5 & # Background process #4
+ sleep 5 & # Background process #5
+ sleep 5 & # Background process #6
+
+ set_color --bold
+ set_color normal
+ set_color --bold blue
+ echo -n "✦6"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_jobs)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_julia.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_julia.test.fish
new file mode 100644
index 00000000..941212b2
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_julia.test.fish
@@ -0,0 +1,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
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_kubecontext.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_kubecontext.test.fish
new file mode 100644
index 00000000..3b0f3400
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_kubecontext.test.fish
@@ -0,0 +1,119 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock kubectl config 0 "echo \"testkube\""
+end
+
+test "Prints section"
+ (
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold cyan
+ echo -n "☸️ testkube (testkube)"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_kubecontext)
+end
+
+test "Kubecontext symbol does not appear outside of a Kubernetes project"
+ (
+ mock kubectl config 1
+ ) = (__sf_section_kubecontext)
+end
+
+test "Changing SPACEFISH_KUBECONTEXT_SYMBOL changes the displayed character"
+ (
+ set SPACEFISH_KUBECONTEXT_SYMBOL "· "
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold cyan
+ echo -n "· testkube (testkube)"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_kubecontext)
+end
+
+test "Changing SPACEFISH_KUBECONTEXT_PREFIX changes the character prefix"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_KUBECONTEXT_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold cyan
+ echo -n "☸️ testkube (testkube)"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_kubecontext)
+end
+
+test "Changing SPACEFISH_KUBECONTEXT_SUFFIX changes the character suffix"
+ (
+ set sf_exit_code 0
+ set SPACEFISH_KUBECONTEXT_SUFFIX ·
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold cyan
+ echo -n "☸️ testkube (testkube)"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_kubecontext)
+end
+
+test "Doesn't display the section when SPACEFISH_KUBECONTEXT_SHOW is set to \"false\""
+ (
+ set SPACEFISH_KUBECONTEXT_SHOW false
+ ) = (__sf_section_kubecontext)
+end
+
+test "Doesn't display the namespace section when SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW is set to \"false\""
+ (
+ set SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW false
+ set sf_exit_code 0
+ set SPACEFISH_KUBECONTEXT_SUFFIX ·
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold cyan
+ echo -n "☸️ testkube"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_kubecontext)
+end
+
+test "Doesn't display the namespace section when kube_context is set to \"default\""
+ (
+ mock kubectl config 0 "echo \"default\""
+
+ set sf_exit_code 0
+ set SPACEFISH_KUBECONTEXT_SUFFIX ·
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold cyan
+ echo -n "☸️ default"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_kubecontext)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_line_sep.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_line_sep.test.fish
new file mode 100644
index 00000000..8d2f8208
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_line_sep.test.fish
@@ -0,0 +1,17 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+test "Echoes a line break"
+ (
+ echo -n -e \n
+ ) = (__sf_section_line_sep)
+end
+
+test "Disabling SPACEFISH_PROMPT_SEPARATE_LINE doesn't display a line break"
+ (
+ set SPACEFISH_PROMPT_SEPARATE_LINE false
+ ) = (__sf_section_line_sep)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_node.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_node.test.fish
new file mode 100644
index 00000000..12622a42
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_node.test.fish
@@ -0,0 +1,192 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock node -v 0 "echo \"v9.8.0\""
+ mkdir -p /tmp/tmp-spacefish/
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Prints section when node_modules is present"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold green
+ echo -n "⬢ v9.8.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_node)
+end
+
+test "Prints section when package.json is present"
+ (
+ touch /tmp/tmp-spacefish/package.json
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold green
+ echo -n "⬢ v9.8.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_node)
+end
+
+test "Doesn't print section when not in a directory with node_modules or package.json"
+ () = (__sf_section_node)
+end
+
+test "Prints nvm version when nvm is installed"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ set -e sf_node_version
+ mock nvm current 0 "echo \"v9.8.0\""
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold green
+ echo -n "⬢ v9.8.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_node)
+end
+
+test "Prints cached nvm version if previously used"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ set sf_node_version "v1.2.3"
+ set sf_last_nvm_bin "path_to_bin"
+ set NVM_BIN "path_to_bin"
+ mock nvm current 0
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold green
+ echo -n "⬢ v1.2.3"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_node)
+end
+
+test "Prints nodenv version when nodenv is installed"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ mock nodenv version-name 0 "echo \"v9.8.0\""
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold green
+ echo -n "⬢ v9.8.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_node)
+
+test "Prints nothing when using the \"system\" version of node with nvm"
+ (
+ mkdir -p /tmp/tmp-spacefish/node_modules
+ mock nvm current 0 "echo \"system\""
+ ) = (__sf_section_node)
+end
+
+test "Prints nothing when using the \"system\" version of node with nodenv"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ mock nodenv version-name 0 "echo \"system\""
+ ) = (__sf_section_node)
+end
+
+test "Prints nodenv version when nodenv is installed"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ mock nodenv version-name 0 "echo \"node\""
+ ) = (__sf_section_node)
+end
+
+test "Changing SPACEFISH_NODE_SYMBOL changes the displayed character"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ mock nvm current 0 "echo \"v9.8.0\""
+ set SPACEFISH_NODE_SYMBOL "· "
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold green
+ echo -n "· v9.8.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_node)
+end
+
+test "Changing SPACEFISH_NODE_PREFIX changes the character prefix"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ set sf_exit_code 0
+ set SPACEFISH_NODE_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold green
+ echo -n "⬢ v9.8.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_node)
+end
+
+test "Changing SPACEFISH_NODE_PREFIX changes the character prefix"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ set sf_exit_code 0
+ set SPACEFISH_NODE_SUFFIX ·
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold green
+ echo -n "⬢ v9.8.0"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_node)
+end
+
+test "Setting SPACEFISH_NODE_DEFAULT_VERSION to the current version disables the section"
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ set sf_exit_code 0
+ set SPACEFISH_NODE_DEFAULT_VERSION v9.8.0
+ ) = (__sf_section_node)
+end
+
+test "doesn't display the section when SPACEFISH_NODE_SHOW is set to \"false\""
+ (
+ mkdir /tmp/tmp-spacefish/node_modules
+ set SPACEFISH_NODE_SHOW false
+ ) = (__sf_section_node)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_package.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_package.test.fish
new file mode 100644
index 00000000..06660730
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_package.test.fish
@@ -0,0 +1,72 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock cargo pkgid 0 "echo \"file:///Users/sirMerr/Development/test-rust#0.1.0\""
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Prints section when Cargo.toml is present"
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold red
+ echo -n "📦 v0.1.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_package)
+end
+
+test "Prints section when package.json is present"
+ (
+ echo "{\"version\": \"1.0\"}" > /tmp/tmp-spacefish/package.json
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold red
+ echo -n "📦 v1.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_package)
+end
+
+test "Changing SPACEFISH_PACKAGE_SUFFIX changes the character suffix"
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+ set SPACEFISH_PACKAGE_SUFFIX ·
+
+ set_color --bold
+ echo -n "is "
+ set_color normal
+ set_color --bold red
+ echo -n "📦 v0.1.0"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_package)
+end
+
+test "Does not print section when Cargo.toml or package.json is not present"
+ () = (__sf_section_package)
+end
+
+test "Doesn't display the section when SPACEFISH_PACKAGE_SHOW is set to \"false\""
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+ set SPACEFISH_PACKAGE_SHOW false
+ ) = (__sf_section_package)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_php.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_php.test.fish
new file mode 100644
index 00000000..f0333bd7
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_php.test.fish
@@ -0,0 +1,110 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock php -v 0 "echo \"PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS )
+ Copyright (c) 1997-2018 The PHP Group
+ Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies\""
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Prints section when composer.json is present"
+ (
+ touch /tmp/tmp-spacefish/composer.json
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold blue
+ echo -n "🐘 v7.1.16"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_php)
+end
+
+test "Prints section when a *.php file is present"
+ (
+ touch /tmp/tmp-spacefish/testfile.php
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold blue
+ echo -n "🐘 v7.1.16"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_php)
+end
+
+test "Doesn't print the section when composer.json and *.php aren't present"
+ () = (__sf_section_php)
+end
+
+test "Changing SPACEFISH_PHP_SYMBOL changes the displayed character"
+ (
+ touch /tmp/tmp-spacefish/composer.json
+ set SPACEFISH_PHP_SYMBOL "· "
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold blue
+ echo -n "· v7.1.16"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_php)
+end
+
+test "Changing SPACEFISH_PHP_PREFIX changes the character prefix"
+ (
+ touch /tmp/tmp-spacefish/composer.json
+ set sf_exit_code 0
+ set SPACEFISH_PHP_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold blue
+ echo -n "🐘 v7.1.16"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_php)
+end
+
+test "Changing SPACEFISH_PHP_SUFFIX changes the character suffix"
+ (
+ touch /tmp/tmp-spacefish/composer.json
+ set sf_exit_code 0
+ set SPACEFISH_PHP_SUFFIX ·
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold blue
+ echo -n "🐘 v7.1.16"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_php)
+end
+
+test "doesn't display the section when SPACEFISH_PHP_SHOW is set to \"false\""
+ (
+ touch /tmp/tmp-spacefish/composer.json
+ set SPACEFISH_PHP_SHOW false
+ ) = (__sf_section_php)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_pyenv.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_pyenv.test.fish
new file mode 100644
index 00000000..b9576800
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_pyenv.test.fish
@@ -0,0 +1,159 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock pyenv version-name 0 "echo \"3.7.0\""
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+ if test "$PYENV_VERSION"
+ set -e PYENV_VERSION
+ end
+end
+
+test "Prints section when \$PYENV_VERSION is defined"
+ (
+ set PYENV_VERSION 3.7.0
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold yellow
+ echo -n "🐍 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "Prints section when .python-version is present"
+ (
+ touch /tmp/tmp-spacefish/.python-version
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold yellow
+ echo -n "🐍 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "Prints section when requirements.txt is present"
+ (
+ touch /tmp/tmp-spacefish/requirements.txt
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold yellow
+ echo -n "🐍 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "Prints section when pyproject.toml is present"
+ (
+ touch /tmp/tmp-spacefish/pyproject.toml
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold yellow
+ echo -n "🐍 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "Prints section when a *.py file is present"
+ (
+ touch /tmp/tmp-spacefish/testfile.py
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold yellow
+ echo -n "🐍 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "Doesn't print the section when requirements.txt and *.py aren't present"
+ () = (__sf_section_pyenv)
+end
+
+test "Changing SPACEFISH_PYENV_SYMBOL changes the displayed character"
+ (
+ touch /tmp/tmp-spacefish/requirements.txt
+ set SPACEFISH_PYENV_SYMBOL "· "
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold yellow
+ echo -n "· 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "Changing SPACEFISH_PYENV_PREFIX changes the character prefix"
+ (
+ touch /tmp/tmp-spacefish/requirements.txt
+ set sf_exit_code 0
+ set SPACEFISH_PYENV_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold yellow
+ echo -n "🐍 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "Changing SPACEFISH_PYENV_SUFFIX changes the character suffix"
+ (
+ touch /tmp/tmp-spacefish/requirements.txt
+ set sf_exit_code 0
+ set SPACEFISH_PYENV_SUFFIX ·
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold yellow
+ echo -n "🐍 3.7.0"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_pyenv)
+end
+
+test "doesn't display the section when SPACEFISH_PYENV_SHOW is set to \"false\""
+ (
+ touch /tmp/tmp-spacefish/requirements.txt
+ set SPACEFISH_PYENV_SHOW false
+ ) = (__sf_section_pyenv)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_rust.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_rust.test.fish
new file mode 100644
index 00000000..ea99a4a9
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_rust.test.fish
@@ -0,0 +1,125 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mock rustc --version 0 "echo \"rustc 1.28.0-nightly (9634041f0 2018-07-30)\""
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Prints section when Cargo.toml is present"
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold red
+ echo -n "𝗥 v1.28.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_rust)
+end
+
+test "Prints section when a *.rs file is present"
+ (
+ touch /tmp/tmp-spacefish/testfile.rs
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold red
+ echo -n "𝗥 v1.28.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_rust)
+end
+
+test "Doesn't print the section when Cargo.toml and *.rs aren't present"
+ () = (__sf_section_rust)
+end
+
+test "Changing SPACEFISH_RUST_SYMBOL changes the displayed character"
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+ set SPACEFISH_RUST_SYMBOL "· "
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold red
+ echo -n "· v1.28.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_rust)
+end
+
+test "Changing SPACEFISH_RUST_PREFIX changes the character prefix"
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+ set sf_exit_code 0
+ set SPACEFISH_RUST_PREFIX ·
+
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ set_color --bold red
+ echo -n "𝗥 v1.28.0"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_rust)
+end
+
+test "Changing SPACEFISH_RUST_SUFFIX changes the character suffix"
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+ set sf_exit_code 0
+ set SPACEFISH_RUST_SUFFIX ·
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold red
+ echo -n "𝗥 v1.28.0"
+ set_color normal
+ set_color --bold
+ echo -n "·"
+ set_color normal
+ ) = (__sf_section_rust)
+end
+
+test "Prints verbose version when configured to do so"
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+ set SPACEFISH_RUST_VERBOSE_VERSION true
+
+ set_color --bold
+ echo -n "via "
+ set_color normal
+ set_color --bold red
+ echo -n "𝗥 v1.28.0-nightly"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_rust)
+end
+
+test "doesn't display the section when SPACEFISH_RUST_SHOW is set to \"false\""
+ (
+ touch /tmp/tmp-spacefish/Cargo.toml
+ set SPACEFISH_RUST_SHOW false
+ ) = (__sf_section_rust)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_time.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_time.test.fish
new file mode 100644
index 00000000..fe7ce215
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_time.test.fish
@@ -0,0 +1,109 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+
+ function date -a time_format
+ command date --version >/dev/null 2>/dev/null
+ switch $status
+ case 0 # GNU Coreutil
+ command date "-u" "-d @1536116421" "$time_format"
+ case '*' # MacOS + BSD Compatibility (Lacks --version)
+ command date "-u" "-r 1536116421" "$time_format"
+ end
+ end
+end
+
+function teardown
+ functions --erase date
+end
+
+test "Time is disabled by default?"
+ () = (__sf_section_time)
+end
+
+test "Enabling time! 24-hour by default"
+ (
+ set SPACEFISH_TIME_SHOW true
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold yellow
+ echo -n "03:00:21"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_time)
+end
+
+test "Enabling time with 12-hour instead"
+ (
+ set SPACEFISH_TIME_SHOW true
+ set SPACEFISH_TIME_12HR true
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold yellow
+ echo -n "03:00:21"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_time)
+end
+
+test "Show the date too"
+ (
+ set SPACEFISH_TIME_SHOW true
+ set SPACEFISH_DATE_SHOW true
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold yellow
+ echo -n "2018-09-05"
+ echo -n " "
+ echo -n "03:00:21"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_time)
+end
+
+test "Custom date/time format"
+ (
+ set SPACEFISH_TIME_SHOW true
+ set SPACEFISH_TIME_FORMAT (date '+%H') # Unix timestamp
+ set SPACEFISH_TIME_PREFIX "" # Get rid of "at " prefix.
+
+ set_color --bold
+ set_color normal
+ set_color --bold yellow
+ echo -n "03"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_time)
+end
+
+test "What is the time? Purple?!"
+ (
+ set SPACEFISH_TIME_SHOW true
+ set SPACEFISH_TIME_COLOR purple
+
+ set_color --bold
+ echo -n "at "
+ set_color normal
+ set_color --bold purple
+ echo -n "03:00:21"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_time)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_user.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_user.test.fish
new file mode 100644
index 00000000..489983de
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_user.test.fish
@@ -0,0 +1,95 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+function teardown
+ set USER $LOGNAME
+end
+
+test "Displays user when different from logname"
+ (
+ set USER spacefishUser
+
+ set_color --bold
+ echo -n "with "
+ set_color normal
+ set_color --bold yellow
+ echo -n "spacefishUser"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_user)
+end
+
+test "Displays user when UID = 0"
+ (
+ set UID 0
+
+ set_color --bold
+ echo -n "with "
+ set_color normal
+ set_color --bold yellow
+ echo -n $USER
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_user)
+end
+
+test "Displays user when there's an SSH connection"
+ (
+ set SSH_CONNECTION "192.168.0.100 12345 192.168.0.101 22"
+
+ set_color --bold
+ echo -n "with "
+ set_color normal
+ set_color --bold yellow
+ echo -n $USER
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_user)
+end
+
+test "Changes user color when logged in as root"
+ (
+ set USER root
+
+ set_color --bold
+ echo -n "with "
+ set_color normal
+ set_color --bold red
+ echo -n root
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_user)
+end
+
+test "Displays user when SPACEFISH_USER_SHOW is set to \"always\""
+ (
+ set SPACEFISH_USER_SHOW always
+
+ set_color --bold
+ echo -n "with "
+ set_color normal
+ set_color --bold yellow
+ echo -n $USER
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_user)
+end
+
+test "Doesn't display user when SPACEFISH_USER_SHOW is set to \"false\""
+ (
+ set SPACEFISH_USER_SHOW false
+ ) = (__sf_section_user)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_venv.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_venv.test.fish
new file mode 100644
index 00000000..f60d23e1
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_venv.test.fish
@@ -0,0 +1,50 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+end
+
+function teardown
+ if test "$VIRTUAL_ENV"
+ set -e VIRTUAL_ENV
+ end
+end
+
+test "Prints section when \$VIRTUAL_ENV is defined"
+ (
+ set VIRTUAL_ENV "/Users/JaneDoe/.venv/coolenviron"
+
+ set_color --bold
+ echo -n $SPACEFISH_PROMPT_DEFAULT_PREFIX
+ set_color normal
+ set_color --bold blue
+ echo -n "·coolenviron"
+ set_color normal
+ set_color --bold
+ echo -n $SPACEFISH_PROMPT_DEFAULT_SUFFIX
+ set_color normal
+ ) = (__sf_section_venv)
+end
+
+test "Prints section when \$VIRTUAL_ENV is defined with venv as the directory name"
+ (
+ set VIRTUAL_ENV "/Users/JaneDoe/.venv/coolenviron/virtualenv"
+
+ set_color --bold
+ echo -n $SPACEFISH_PROMPT_DEFAULT_PREFIX
+ set_color normal
+ set_color --bold blue
+ echo -n "·coolenviron"
+ set_color normal
+ set_color --bold
+ echo -n $SPACEFISH_PROMPT_DEFAULT_SUFFIX
+ set_color normal
+ ) = (__sf_section_venv)
+end
+
+test "doesn't display the section when SPACEFISH_VENV_SHOW is set to \"false\""
+ (
+ set VIRTUAL_ENV "/Users/JaneDoe/.venv/coolenviron"
+ set SPACEFISH_VENV_SHOW false
+ ) = (__sf_section_venv)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_vi_mode.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_vi_mode.test.fish
new file mode 100644
index 00000000..4a9bda20
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_section_vi_mode.test.fish
@@ -0,0 +1,144 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ fish_vi_key_bindings; or true
+ # Unfortunately right after enabling vi-keys it's in 'normal' state on CI and in 'insert' locally
+ set fish_bind_mode insert
+end
+
+test "Prints section when fish_vi_key_bindigs is set"
+ (
+ set_color --bold
+ echo -n " "
+ set_color normal
+ set_color --bold white
+ echo -n "[I]"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Prints SPACEFISH_VI_MODE_VISUAL when fish_bind_mode is visual"
+ (
+ set fish_bind_mode visual
+ set SPACEFISH_VI_MODE_VISUAL "-V-"
+
+ set_color --bold
+ echo -n " "
+ set_color normal
+ set_color --bold white
+ echo -n $SPACEFISH_VI_MODE_VISUAL
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Prints SPACEFISH_VI_MODE_REPLACE_ONE when fish_bind_mode is replace_one"
+ (
+ set fish_bind_mode replace_one
+ set SPACEFISH_VI_MODE_REPLACE_ONE "-R-"
+
+ set_color --bold
+ echo -n " "
+ set_color normal
+ set_color --bold white
+ echo -n $SPACEFISH_VI_MODE_REPLACE_ONE
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Prints SPACEFISH_VI_MODE_NORMAL when fish_bind_mode is normal"
+ (
+ set fish_bind_mode default
+ set SPACEFISH_VI_MODE_NORMAL "-N-"
+
+ set_color --bold
+ echo -n " "
+ set_color normal
+ set_color --bold white
+ echo -n $SPACEFISH_VI_MODE_NORMAL
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Prints SPACEFISH_VI_MODE_INSERT when fish_bind_mode is insert"
+ (
+ set fish_bind_mode insert
+ set SPACEFISH_VI_MODE_INSERT "-I-"
+
+ set_color --bold
+ echo -n " "
+ set_color normal
+ set_color --bold white
+ echo -n $SPACEFISH_VI_MODE_INSERT
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Prints prefix when SPACEFISH_VI_MODE_PREFIX is set"
+ (
+ set SPACEFISH_VI_MODE_PREFIX "VIM "
+
+ set_color --bold
+ echo -n "$SPACEFISH_VI_MODE_PREFIX"
+ set_color normal
+ set_color --bold white
+ echo -n "[I]"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Prints suffix when SPACEFISH_VI_MODE_SUFFIX is set"
+ (
+ set SPACEFISH_VI_MODE_SUFFIX " VIM "
+
+ set_color --bold
+ echo -n " "
+ set_color normal
+ set_color --bold white
+ echo -n "[I]"
+ set_color normal
+ set_color --bold
+ echo -n $SPACEFISH_VI_MODE_SUFFIX
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Use color from SPACEFISH_VI_MODE_COLOR"
+ (
+ set SPACEFISH_VI_MODE_COLOR red
+
+ set_color --bold
+ echo -n " "
+ set_color normal
+ set_color --bold red
+ echo -n "[I]"
+ set_color normal
+ set_color --bold
+ echo -n " "
+ set_color normal
+ ) = (__sf_section_vi_mode)
+end
+
+test "Don't print anything if SPACEFISH_VI_MODE_SHOW is false"
+ (
+ set SPACEFISH_VI_MODE_SHOW false
+ ) = (__sf_section_vi_mode)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_git_branch.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_git_branch.test.fish
new file mode 100644
index 00000000..33a65a1a
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_git_branch.test.fish
@@ -0,0 +1,45 @@
+source $DIRNAME/spacefish_test_setup.fish
+
+function setup
+ spacefish_test_setup
+ mkdir -p /tmp/tmp-spacefish
+ cd /tmp/tmp-spacefish
+ command git init >/dev/null
+ command git config --local user.email "test@example.com"
+ command git config --local user.name "Test User"
+end
+
+function teardown
+ rm -rf /tmp/tmp-spacefish
+end
+
+test "Identifies HEAD before initial commit"
+ (
+ echo "HEAD"
+ ) = (__sf_util_git_branch)
+end
+
+test "Identifies master branch"
+ (
+ command git commit --allow-empty -m "initial commit" --quiet
+
+ echo "master"
+ ) = (__sf_util_git_branch)
+end
+
+test "Identifies an alternate branch name"
+ (
+ command git checkout -b "testBranch" 2>/dev/null
+ command git commit --allow-empty -m "initial commit" --quiet
+
+ echo "testBranch"
+ ) = (__sf_util_git_branch)
+end
+
+test "No result provided for non-git directory"
+ (
+ cd ~
+
+ echo ""
+ ) = (__sf_util_git_branch)
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_human_time.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_human_time.test.fish
new file mode 100644
index 00000000..730cc027
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_human_time.test.fish
@@ -0,0 +1,89 @@
+test "Shows milliseconds"
+ '1ms' = (
+ echo 1 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows seconds"
+ '1s' = (
+ echo 1000 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows seconds and milliseconds"
+ '1s 1ms' = (
+ echo 1001 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows minutes"
+ '1m' = (
+ echo 60000 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows minutes and milliseconds"
+ '1m 1ms' = (
+ echo 60001 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows minutes and seconds"
+ '1m 1s' = (
+ echo 61000 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows minutes, seconds, and milliseconds"
+ '1m 1s 1ms' = (
+ echo 61001 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours"
+ '1h' = (
+ echo 3600000 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours and milliseconds"
+ '1h 1ms' = (
+ echo 3600001 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours and seconds"
+ '1h 1s' = (
+ echo 3601000 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours, seconds, and milliseconds"
+ '1h 1s 1ms' = (
+ echo 3601001 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours and minutes"
+ '1h 1m' = (
+ echo 3660000 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours, minutes, and milliseconds"
+ '1h 1m 1ms' = (
+ echo 3660001 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours, minutes, and seconds"
+ '1h 1m 1s' = (
+ echo 3661000 | __sf_util_human_time my_var
+ )
+end
+
+test "Shows hours, minutes, seconds, and milliseconds"
+ '1h 1m 1s 1ms' = (
+ echo 3661001 | __sf_util_human_time my_var
+ )
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_set_default.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_set_default.test.fish
new file mode 100644
index 00000000..de2faa57
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_set_default.test.fish
@@ -0,0 +1,14 @@
+test "Sets a variable"
+ 'default_value' = (
+ __sf_util_set_default my_var 'default_value'
+ echo $my_var
+ )
+end
+
+test "Skips setting a variable if one is already set"
+ 'default_value' = (
+ __sf_util_set_default my_var 'default_value'
+ __sf_util_set_default my_var 'another_value'
+ echo $my_var
+ )
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_truncate_dir.test.fish b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_truncate_dir.test.fish
new file mode 100644
index 00000000..3ac1e2cf
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/__sf_util_truncate_dir.test.fish
@@ -0,0 +1,28 @@
+set path /tmp/$DIRNAME/$TESTNAME
+
+function setup
+ mkdir -p $path/temp1/temp2/temp3
+ cd $path/temp1/temp2/temp3
+end
+
+function teardown
+ rm -rf $path
+end
+
+test "Truncate path to 1 directory"
+ 'temp3' = (
+ __sf_util_truncate_dir (pwd) 1
+ )
+end
+
+test "Truncate path to 3 directories"
+ 'temp1/temp2/temp3' = (
+ __sf_util_truncate_dir (pwd) 3
+ )
+end
+
+test "Don't truncate path"
+ (pwd) = (
+ __sf_util_truncate_dir (pwd) 0
+ )
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/run.fish b/.config/fisher/github.com/matchai/spacefish/tests/run.fish
new file mode 100755
index 00000000..132bf15d
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/run.fish
@@ -0,0 +1,22 @@
+#!/usr/bin/env fish
+
+set -l gitRoot (git rev-parse --show-toplevel)
+set -l testDir (dirname (status --current-filename))
+set -l tmpDir /tmp/spacefish
+
+# Install fisher if not installed in temporary fish env
+if test ! -f $tmpDir/.config/fish/functions/fisher.fish
+ curl https://git.io/fisher --create-dirs -sLo $tmpDir/.config/fish/functions/fisher.fish
+end
+
+# Install fishtape and local spacefish into temp env
+env HOME=$tmpDir fish -c "fisher add jorgebucaran/fishtape@7426171 matchai/fish-mock $gitRoot"
+env HOME=$tmpDir fish -c "fish_prompt"
+
+if test (count $argv) -gt 0
+ # Run an individual test file if it is provided as an argument
+ env HOME=$tmpDir fish -c "fishtape $argv[1]"
+else
+ # Otherwise run all test files
+ env HOME=$tmpDir fish -c "fishtape $testDir/*.test.fish"
+end
diff --git a/.config/fisher/github.com/matchai/spacefish/tests/spacefish_test_setup.fish b/.config/fisher/github.com/matchai/spacefish/tests/spacefish_test_setup.fish
new file mode 100644
index 00000000..31001a7f
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/tests/spacefish_test_setup.fish
@@ -0,0 +1,14 @@
+function spacefish_test_setup
+ # Delete all lingering spacefish variables
+ set --name | grep -E '^(SPACEFISH_|sf_)' | while read -l var
+ set -e $var
+ end
+
+ # Delete lingering mocked functions
+ for mock in $_mocked
+ unmock $mock
+ end
+
+ # Initialize spacefish theme
+ fish_prompt>/dev/null
+end