summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2013-07-25 10:32:52 +0100
committerLee Jarvis <ljjarvis@gmail.com>2013-07-25 10:32:52 +0100
commit7cfca3fdca18480e06badc68523ea84e1226f0e8 (patch)
tree6662f06b9e5e5a67ac99ecb35f462dd3eca28388 /test
parent8c4caa9d5e6fa799087528b60e1acaf37c72de63 (diff)
downloadslop-7cfca3fdca18480e06badc68523ea84e1226f0e8.tar.gz
Ensure unknown options are reported for multiple switches
Before this commit we just skipped an option if it wasn't found, we should instead raise an error. closes #122
Diffstat (limited to 'test')
-rw-r--r--test/slop_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/slop_test.rb b/test/slop_test.rb
index 856a58b..ece71a6 100644
--- a/test/slop_test.rb
+++ b/test/slop_test.rb
@@ -228,6 +228,12 @@ class SlopTest < TestCase
assert_raises(Slop::InvalidOptionError) { opts.parse %w'-fabc' }
end
+ test "raising InvalidOptionError for multiple short options" do
+ opts = Slop.new :strict => true
+ opts.on :L
+ assert_raises(Slop::InvalidOptionError) { opts.parse %w'-Ly' }
+ end
+
test "multiple_switches is enabled by default" do
opts = Slop.new { on :f; on :b }
opts.parse %w[ -fb ]