summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLee Jarvis <leejarvis@fastmail.com>2017-01-29 21:57:04 +0000
committerLee Jarvis <leejarvis@fastmail.com>2017-01-29 21:57:04 +0000
commitf9010939a1debceb22152672df2bc1585c57ceec (patch)
tree9dabc1a5365727ba124c29a90ae90ce6d4367d44 /test
parentf88f4d87458034771f8e1e5f533fafd5892802b5 (diff)
downloadslop-f9010939a1debceb22152672df2bc1585c57ceec.tar.gz
Fix support for parsing -x5
Thanks to @RickHull for the "smashing" terminology and various conversations Fixes #199
Diffstat (limited to 'test')
-rw-r--r--test/parser_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/parser_test.rb b/test/parser_test.rb
index 339a522..fa372cf 100644
--- a/test/parser_test.rb
+++ b/test/parser_test.rb
@@ -66,6 +66,19 @@ describe Slop::Parser do
end
end
+ describe "short flags with arguments" do
+ before do
+ @options.integer "-i"
+ @options.string "-s"
+ end
+
+ it "parses the argument" do
+ @result.parser.parse %w(-i5 -sfoo)
+ assert_equal 5, @result[:i]
+ assert_equal "foo", @result[:s]
+ end
+ end
+
describe "#used_options" do
it "returns all options that were parsed" do
assert_equal [@verbose, @name], @parser.used_options