aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/formula_support_test.rb
blob: c0a79f950c0565ae153f57ee431ccbb7fc59ce08 (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
require "testing_env"
require "formula_support"

class KegOnlyReasonTests < Homebrew::TestCase
  def test_to_s_explanation
    r = KegOnlyReason.new :provided_by_osx, "test"
    assert_equal "test", r.to_s
  end

  def test_to_s_no_explanation
    r = KegOnlyReason.new :provided_by_macos, ""
    assert_match(/^macOS already provides/, r.to_s)
  end
end

class BottleDisableReasonTests < Homebrew::TestCase
  def test_bottle_unneeded
    bottle_disable_reason = BottleDisableReason.new :unneeded, nil
    assert_predicate bottle_disable_reason, :unneeded?
    assert_equal "This formula doesn't require compiling.", bottle_disable_reason.to_s
  end

  def test_bottle_disabled
    bottle_disable_reason = BottleDisableReason.new :disable, "reason"
    refute_predicate bottle_disable_reason, :unneeded?
    assert_equal "reason", bottle_disable_reason.to_s
  end
end