aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_options.rb
diff options
context:
space:
mode:
authorBaptiste Fontaine2015-07-20 21:46:05 +0200
committerBaptiste Fontaine2015-07-25 00:00:30 +0200
commitca1f5dc713313485b13512571cd222c4e89730a3 (patch)
treee70a35c03fd0b59ae211ae043f00bbf0779a4456 /Library/Homebrew/test/test_options.rb
parenta675aae553949706c54c8868a941373d73909260 (diff)
downloadbrew-ca1f5dc713313485b13512571cd222c4e89730a3.tar.bz2
more unit tests
Closes Homebrew/homebrew#42096. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library/Homebrew/test/test_options.rb')
-rw-r--r--Library/Homebrew/test/test_options.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_options.rb b/Library/Homebrew/test/test_options.rb
index e9d3d0836..604727961 100644
--- a/Library/Homebrew/test/test_options.rb
+++ b/Library/Homebrew/test/test_options.rb
@@ -23,6 +23,10 @@ class OptionTests < Homebrew::TestCase
assert_empty @option.description
assert_equal "foo", Option.new("foo", "foo").description
end
+
+ def test_inspect
+ assert_equal "#<Option: \"--foo\">", @option.inspect
+ end
end
class DeprecatedOptionTests < Homebrew::TestCase
@@ -121,10 +125,21 @@ class OptionsTests < Homebrew::TestCase
assert_equal [foo, bar, baz].sort, (@options | options).sort
end
+ def test_times
+ @options << Option.new("aa") << Option.new("bb") << Option.new("cc")
+ assert_equal %w[--aa --bb --cc], (@options * "XX").split("XX").sort
+ end
+
def test_create_with_array
array = %w{--foo --bar}
option1 = Option.new("foo")
option2 = Option.new("bar")
assert_equal [option1, option2].sort, Options.create(array).sort
end
+
+ def test_inspect
+ assert_equal "#<Options: []>", @options.inspect
+ @options << Option.new("foo")
+ assert_equal "#<Options: [#<Option: \"--foo\">]>", @options.inspect
+ end
end