aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorGreg Nisbet2016-05-22 18:02:39 -0700
committerGreg Nisbet2016-08-10 23:21:30 -0700
commitbf63c08d50acb5fa79413325029e67e2c28a6023 (patch)
tree62b24664cd59a42c4dae6dacaaef12da81a6b419 /Library/Homebrew/test
parentf0cc815d86aceec61adca10606124ad840b0398a (diff)
downloadbrew-bf63c08d50acb5fa79413325029e67e2c28a6023.tar.bz2
tests for shell-specific diagnostic message
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_integration_cmds.rb2
-rw-r--r--Library/Homebrew/test/test_shell.rb21
2 files changed, 22 insertions, 1 deletions
diff --git a/Library/Homebrew/test/test_integration_cmds.rb b/Library/Homebrew/test/test_integration_cmds.rb
index 1a5db6b6f..8801071d2 100644
--- a/Library/Homebrew/test/test_integration_cmds.rb
+++ b/Library/Homebrew/test/test_integration_cmds.rb
@@ -238,7 +238,7 @@ class IntegrationCommandTests < Homebrew::TestCase
end
def test_env_csh
- assert_match %r{setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)}},
+ assert_match %r{setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};},
cmd("--env", "--shell=tcsh")
end
diff --git a/Library/Homebrew/test/test_shell.rb b/Library/Homebrew/test/test_shell.rb
index 5a1057457..5e054f9d9 100644
--- a/Library/Homebrew/test/test_shell.rb
+++ b/Library/Homebrew/test/test_shell.rb
@@ -35,4 +35,25 @@ class ShellSmokeTest < Homebrew::TestCase
assert_equal "\\$", Utils::Shell.csh_quote("$")
assert_equal "word", Utils::Shell.csh_quote("word")
end
+
+ def prepend_path_shell(shell, path, fragment)
+ original_shell = ENV["SHELL"]
+ ENV["SHELL"] = shell
+
+ prepend_message = Utils::Shell.prepend_path_in_shell_profile(path)
+ assert(
+ prepend_message.start_with?(fragment),
+ "#{shell}: expected #{prepend_message} to match #{fragment}"
+ )
+
+ ENV["SHELL"] = original_shell
+ end
+
+ def test_prepend_path_in_shell_profile()
+ prepend_path_shell "/bin/tcsh", "/path", "echo 'setenv PATH /path"
+
+ prepend_path_shell "/bin/bash", "/path", "echo 'export PATH=\"/path"
+
+ prepend_path_shell "/usr/local/bin/fish", "/path", "echo 'set -g fish_user_paths \"/path\" $fish_user_paths' >>"
+ end
end