aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-07-24 00:49:34 +0200
committerBaptiste Fontaine2015-07-28 20:40:28 +0200
commitea08e4fb16b7f9ffc66b267d532bcdea4f513f0b (patch)
tree68561e0d7eacc8281127460f6db7864fa635a545 /Library/Homebrew/test
parentea13d62ce0f23f22abd14e04cf87ce6babb07ef5 (diff)
downloadbrew-ea08e4fb16b7f9ffc66b267d532bcdea4f513f0b.tar.bz2
KegOnlyReason: print only the explanation if there’s one
Closes Homebrew/homebrew#42073. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_formula_support.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_formula_support.rb b/Library/Homebrew/test/test_formula_support.rb
new file mode 100644
index 000000000..08d10292f
--- /dev/null
+++ b/Library/Homebrew/test/test_formula_support.rb
@@ -0,0 +1,13 @@
+require "testing_env"
+
+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_osx, ""
+ assert_match(/^OS X already provides/, r.to_s)
+ end
+end