This uses the "::" extension to getopt() to handle options which take
an optional argument.
The updated flag tests were all wrong before and only passed because
the manual parser failed to raise errors when a required argument was
missing. The invalid argument test now gets a better error message.
In general the tests are pretty worthless. They don't actually test
any real functionality of the tool and provide a false sense that the
tests actually mean something.