add test for an option passed in twice

This commit is contained in:
Josh Holtrop 2013-01-21 21:19:36 -05:00
parent 91846e741e
commit bf60247b50

View File

@ -77,5 +77,15 @@ describe Yawpa do
opts[:opt].should eq(['val1', 'val2'])
args.should eq(['arg'])
end
it "returns the last set value when an option is passed twice" do
options = {
opt: {nargs: 1},
}
params = ['--opt', 'val1', 'arg1', '--opt', 'val2', 'arg2']
opts, args = Yawpa.parse(params, options)
opts[:opt].should eq('val2')
args.should eq(['arg1', 'arg2'])
end
end
end