aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cmd/--env_spec.rb
blob: 7dd84132ad571328bdd655509b4b84bd853aa6e6 (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
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