mozilla/rust — pull request #5329 by wanderview (2013-03-12 03:19:08+00:00)
Title: Fix std::getopts::opts_present() to check value.

Currently the opts_present() function only checks to see if the option is
configured in the match, but doesn't actually check to see if the option
value has been set. This means that opt_present('h') may return false while
opts_present([~'h']) returns true.

Add a test case to catch this condition and fix opts_present() to check
the value before returning true.

Note, there is another API difference between these two functions that this
does not address. Currently if you pass a non-configured option to
opt_present() the program will fail!(), but opts_present() simply returns
false. If it is acceptable to standardize on the fail!() then opts_present()
should probably be implemented in terms of the opt_present() function.