From 1a5de331d95374ad05637861c1248ccf2867a00b Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 21 Jan 2013 16:15:17 -0500 Subject: [PATCH] test --opt=val syntax for nargs > 1 --- spec/yawpa_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/yawpa_spec.rb b/spec/yawpa_spec.rb index 8a50980..18dc016 100644 --- a/spec/yawpa_spec.rb +++ b/spec/yawpa_spec.rb @@ -67,5 +67,15 @@ describe Yawpa do opts[:opt].should eq('thevalue') args.should eq(['arg']) end + + it "uses --opt=val for the first option argument when nargs > 1" do + options = { + opt: {nargs: 2}, + } + params = ['--opt=val1', 'val2', 'arg'] + opts, args = Yawpa.parse(params, options) + opts[:opt].should eq(['val1', 'val2']) + args.should eq(['arg']) + end end end