It's kind of weird to provide an argument without a description, but it's
not crash-worthy (especially when the crash was a totally unhelpful
exception stack trace). While we're here, test for a couple of other ones
that didn't cause a crash, but we want to keep it that way.
And fix the copyright message; actually options.py started in 2010.
Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
-# Copyright 2011 Avery Pennarun and options.py contributors.
+# Copyright 2010-2012 Avery Pennarun and options.py contributors.
# All rights reserved.
#
# (This license applies to this file but not necessarily the other files in
l.lstrip()))
last_was_option = False
elif l:
- (flags, extra) = l.split(' ', 1)
+ (flags,extra) = (l + ' ').split(' ', 1)
extra = extra.strip()
if flags.endswith('='):
flags = flags[:-1]
from bup import options
from wvtest import *
+
@wvtest
def test_optdict():
d = options.OptDict()
WVFAIL("exception expected")
+invalid_optspec0 = """
+"""
+
+
+invalid_optspec1 = """
+prog <whatever>
+"""
+
+
+invalid_optspec2 = """
+--
+x,y
+"""
+
+
+@wvtest
+def test_invalid_optspec():
+ WVPASS(options.Options(invalid_optspec0).parse([]))
+ WVPASS(options.Options(invalid_optspec1).parse([]))
+ WVPASS(options.Options(invalid_optspec2).parse([]))
+
+
optspec = """
prog <optionset> [stuff...]
prog [-t] <boggle>