diff options
author | Lee Jarvis <lee@jarvis.co> | 2011-04-24 16:02:44 +0100 |
---|---|---|
committer | Lee Jarvis <lee@jarvis.co> | 2011-04-24 16:02:44 +0100 |
commit | ee8fcd043c044053f30e839c21746be4078251c8 (patch) | |
tree | 7599b5961fa5d6350461dad3c78f0d650dcf75b3 /test/option_test.rb | |
parent | 9b7425bc240e4310640273f5c93612cfeede65d9 (diff) | |
download | slop-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.rb | 7 |
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 |