aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_ENV.rb
blob: 8ab1c1f249d56d209568f15a9f92ec4069e5a194 (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
require 'testing_env'
require 'utils'
require 'hardware'
require 'extend/ENV'
require 'extend/ARGV'
ENV.extend(HomebrewEnvExtension)
ARGV.extend(HomebrewArgvExtension)
  
class EnvironmentTests < Test::Unit::TestCase
  def test_ENV_options
    ENV.gcc_4_0
    begin
      ENV.gcc_4_2
    rescue RuntimeError => e
      if `sw_vers -productVersion` =~ /10\.(\d+)/ and $1.to_i < 7
        raise e
      end
    end
    ENV.O3
    ENV.minimal_optimization
    ENV.no_optimization
    ENV.libxml2
    ENV.x11
    ENV.enable_warnings
    assert !ENV.cc.empty?
    assert !ENV.cxx.empty?
  end

  def test_switching_compilers
    ENV.llvm
    ENV.clang
    assert_equal ENV['LD'], ENV['CC']
    assert_equal ENV['OBJC'], ENV['CC']
  end
end