diff options
Diffstat (limited to 'Library/Homebrew/test/cmd')
| -rw-r--r-- | Library/Homebrew/test/cmd/--env_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cmd/--env_spec.rb b/Library/Homebrew/test/cmd/--env_spec.rb new file mode 100644 index 000000000..7dd84132a --- /dev/null +++ b/Library/Homebrew/test/cmd/--env_spec.rb @@ -0,0 +1,44 @@ +describe "brew --env", :integration_test do + it "prints the Homebrew build environment variables" do + expect { brew "--env" } + .to output(/CMAKE_PREFIX_PATH="#{Regexp.escape(HOMEBREW_PREFIX)}[:"]/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + + describe "--shell=bash" do + it "prints the Homebrew build environment variables in Bash syntax" do + expect { brew "--env", "--shell=bash" } + .to output(/export CMAKE_PREFIX_PATH="#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + end + + describe "--shell=fish" do + it "prints the Homebrew build environment variables in Fish syntax" do + expect { brew "--env", "--shell=fish" } + .to output(/set [-]gx CMAKE_PREFIX_PATH "#{Regexp.quote(HOMEBREW_PREFIX.to_s)}"/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + end + + describe "--shell=tcsh" do + it "prints the Homebrew build environment variables in Tcsh syntax" do + expect { brew "--env", "--shell=tcsh" } + .to output(/setenv CMAKE_PREFIX_PATH #{Regexp.quote(HOMEBREW_PREFIX.to_s)};/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + end + + describe "--plain" do + it "prints the Homebrew build environment variables without quotes" do + expect { brew "--env", "--plain" } + .to output(/CMAKE_PREFIX_PATH: #{Regexp.quote(HOMEBREW_PREFIX)}/).to_stdout + .and not_to_output.to_stderr + .and be_a_success + end + end +end |
