From 1264729e19ee69b8ff04c3b6c2ab4650e34b4067 Mon Sep 17 00:00:00 2001 From: Lee Jarvis Date: Wed, 19 Nov 2014 16:24:47 +0000 Subject: Support flag=arg --- test/parser_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test') 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 -- cgit v1.2.1