(#6749) Fix optional vs mandatory argument handling.
optparse will treat '--foo --bar' as "foo with the argument --bar" when foo
takes a mandatory argument. We need to emulate that behaviour in our
pre-parse of the command line.
Incidentally, fix up a bug in boolean options, and improve our testing.
Reviewed-By: Nick Lewis <nick@puppetlabs.com>