]> arthur.barton.de Git - bup.git/blobdiff - lib/bup/t/toptions.py
options.py: don't crash given semi-invalid optspecs.
[bup.git] / lib / bup / t / toptions.py
index 7a0da0c60c32e837d4cac817071105bc6394bd63..d01227703a0d8cf3c9569657c6ced832118da2c7 100644 (file)
@@ -1,6 +1,7 @@
 from bup import options
 from wvtest import *
 
+
 @wvtest
 def test_optdict():
     d = options.OptDict()
@@ -22,6 +23,28 @@ def test_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>