Project

General

Profile

Actions

Bug #8865

closed

OptionParser acceptable bugs

Added by drbrain (Eric Hodel) about 11 years ago. Updated almost 11 years ago.

Status:
Closed
Target version:
-
ruby -v:
-
[ruby-core:57024]

Description

I have found a few bugs in OptionParser's accept feature:

Hexadecimal and binary numbers are not properly supported for Integer

OptionParser::DecimalInteger, OptionParser::OctalInteger and OptionParser::DecimalNumeric convert invalid input to 0 or nil instead of raising InvalidArgument.

The attached patch fixes the validation regular expression for handling binary and hexadecimal arguments and adds verification for DecimalInteger, OctalInteger and DecimalNumeric


Files

optparse.rb.accept.patch (1.63 KB) optparse.rb.accept.patch drbrain (Eric Hodel), 09/05/2013 06:00 AM
optparse.rb.accept.2.patch (6.85 KB) optparse.rb.accept.2.patch drbrain (Eric Hodel), 09/05/2013 09:20 AM
optparse.rb.accept.3.patch (7.77 KB) optparse.rb.accept.3.patch drbrain (Eric Hodel), 09/05/2013 09:47 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0