Project

General

Profile

Feature #8460 ยป 0003-optparse-properly-keep-dash-dash.patch

felipec (Felipe Contreras), 05/27/2021 10:07 PM

View differences:

lib/optparse.rb
1556 1556
        case arg
1557 1557
        # dash dash
1558 1558
        when /\A--\Z/m
1559
          nonopt.call(arg) if keep_unknown
1559 1560
          break
1560 1561

  
1561 1562
        # long option
test/optparse/test_optparse.rb
111 111
    assert_raise(OptionParser::InvalidOption) {@opt.parse(%w(--mis))}
112 112
    @opt.keep_unknown = true
113 113
    assert_equal(%w(--mis arg), @opt.parse(%w(--mis -x arg)))
114
    assert_equal(%w(--mis -- -x arg), @opt.parse(%w(--mis -- -x arg)))
114 115
  end
115 116
end