diff options
author | Lee Jarvis <ljjarvis@gmail.com> | 2014-11-19 16:24:47 +0000 |
---|---|---|
committer | Lee Jarvis <ljjarvis@gmail.com> | 2014-11-19 16:38:06 +0000 |
commit | 1264729e19ee69b8ff04c3b6c2ab4650e34b4067 (patch) | |
tree | e56cec2b92863001c42e1cfb11a0f2b0e3125191 /test/parser_test.rb | |
parent | 2a312300798d1da4aa666a0888f8a94a5ee5f245 (diff) | |
download | slop-1264729e19ee69b8ff04c3b6c2ab4650e34b4067.tar.gz |
Support flag=arg
Diffstat (limited to 'test/parser_test.rb')
-rw-r--r-- | test/parser_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/parser_test.rb b/test/parser_test.rb index 950c1f4..a2cd3a5 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -15,6 +15,25 @@ describe Slop::Parser do assert_equal [@verbose], @parser.used_options end + it "parses flag=argument" do + @options.integer "-p", "--port" + @result.parser.reset.parse %w(--name=bob -p=123) + assert_equal "bob", @result[:name] + assert_equal 123, @result[:port] + end + + describe "parsing grouped short flags" do + before do + @options.bool "-q", "--quiet" + end + + it "parses boolean flags" do + @result.parser.reset.parse %w(-qv) + assert_equal true, @result.quiet? + assert_equal true, @result.verbose? + end + end + describe "#used_options" do it "returns all options that were parsed" do assert_equal [@verbose, @name], @parser.used_options |