summaryrefslogtreecommitdiff
path: root/test/option_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2011-04-24 16:02:44 +0100
committerLee Jarvis <lee@jarvis.co>2011-04-24 16:02:44 +0100
commitee8fcd043c044053f30e839c21746be4078251c8 (patch)
tree7599b5961fa5d6350461dad3c78f0d650dcf75b3 /test/option_test.rb
parent9b7425bc240e4310640273f5c93612cfeede65d9 (diff)
downloadslop-ee8fcd043c044053f30e839c21746be4078251c8.tar.gz
add Option#count method which increases every time an option is invoked
Diffstat (limited to 'test/option_test.rb')
-rw-r--r--test/option_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/option_test.rb b/test/option_test.rb
index 472b17b..1028e16 100644
--- a/test/option_test.rb
+++ b/test/option_test.rb
@@ -138,4 +138,11 @@ class OptionTest < TestCase
assert_equal nil, slop[:foo]
refute_equal "", slop[:foo]
end
+
+ test 'counting options' do
+ slop = Slop.new { on :v; on :x }
+ slop.parse %w/-v -v -v -x/
+ assert_equal 1, slop.options[:x].count
+ assert_equal 3, slop.options[:v].count
+ end
end