aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/options.rb17
-rw-r--r--Library/Homebrew/test/test_options.rb14
2 files changed, 31 insertions, 0 deletions
diff --git a/Library/Homebrew/options.rb b/Library/Homebrew/options.rb
index 65be6e1f4..edeb5d870 100644
--- a/Library/Homebrew/options.rb
+++ b/Library/Homebrew/options.rb
@@ -32,6 +32,23 @@ class Option
end
end
+class DeprecatedOption
+ attr_reader :old, :current
+
+ def initialize(old, current)
+ @old = old
+ @current = current
+ end
+
+ def old_flag
+ "--#{old}"
+ end
+
+ def current_flag
+ "--#{current}"
+ end
+end
+
class Options
include Enumerable
diff --git a/Library/Homebrew/test/test_options.rb b/Library/Homebrew/test/test_options.rb
index 73ff2b752..1bd5ba3b0 100644
--- a/Library/Homebrew/test/test_options.rb
+++ b/Library/Homebrew/test/test_options.rb
@@ -25,6 +25,20 @@ class OptionTests < Homebrew::TestCase
end
end
+class DeprecatedOptionTests < Homebrew::TestCase
+ def setup
+ @deprecated_option = DeprecatedOption.new("foo", "bar")
+ end
+
+ def test_old
+ assert_equal "foo", @deprecated_option.old
+ end
+
+ def test_current
+ assert_equal "bar", @deprecated_option.current
+ end
+end
+
class OptionsTests < Homebrew::TestCase
def setup
@options = Options.new