diff --git a/test-tc.py b/test-tc.py index bd1882e..07ec0bf 100755 --- a/test-tc.py +++ b/test-tc.py @@ -3,7 +3,7 @@ # Copyright (c) 2003-2004 TundraWare Inc. All Rights Reserved. PROGNAME = "tconfpy Test Driver" -RCSID = "$Id: test-tc.py,v 1.130 2004/04/08 17:15:41 tundra Exp $" +RCSID = "$Id: test-tc.py,v 1.131 2004/04/16 05:47:29 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -55,12 +55,15 @@ # by the VarDescriptor base class. -syms = [ ["foo", 1, True, TYPE_INT, 0, [1, 2, 23], 1, 30 ], - ["fox", 1.0, None, TYPE_FLOAT, 0.5, [3.14, 2.73], None, None ], - ["bar", "stringy", None, None, None, [r'^box$', r'^Bax', r'a+bc'], 3, 8 ], - ["baz", 4+5j, None, TYPE_COMPLEX, 0-0j, [], None, None ], - ["boo", True, None, TYPE_BOOL, None, None, None, None ], - ["read", "ReadVar", False, None, None, None, None, None ], +syms = [ ["int1", 1, True, TYPE_INT, 0, [1, 2, 23], None, None ], + ["int2", 1, True, TYPE_INT, 0, [], 1, 30 ], + ["float1", 1.0, None, TYPE_FLOAT, 0.5, [3.14, 2.73], None, None ], + ["float2", 1.0, None, TYPE_FLOAT, 0.5, [], -1.2, 0.5 ], + ["str1" , "stringy", None, None, None, [r'^box$', r'^Bax', r'a+bc'], 3, 8 ], + ["cmplx1", 4+5j, None, TYPE_COMPLEX, 0-0j, [], None, None ], + ["cmplx2", 4+5j, None, TYPE_COMPLEX, 0-0j, [1-1j, 1+1j], None, None ], + ["bool1", True, None, TYPE_BOOL, None, None, None, None ], + ["ro1", "ReadVar", False, None, None, None, None, None ], ] @@ -95,15 +98,6 @@ symtbl["MyComplex1"] = mc1 symtbl["MyComplex2"] = mc2 -# Just for fun, define an initial namespace and -# some other "legal" namespaces for use in testing -# the AllowNewNamespaces option of the API - -des = VarDescriptor() -des.Value = "" # This is the initial namespace -des.LegalVals = ["NS1", "NS2"] -symtbl["NAMESPACE"] = des - #---------------------------------------------------------------------------# # Nothing Else Should Need Changing Below Here @@ -197,48 +191,62 @@ if len(sys.argv) < 2: print BANNER - print "Usage: test-tc.py [symtbl] [nonewvar] [nonewns] [debug] [litvars] file file ..." + print "Usage: test-tc.py [symtbl] [nonewvar] [limitns] [debug] [litvars] file file ..." sys.exit(1) # Process all the requested configuration files, # dumping the what tconfpy returns for each one. ALLOWVAR = True -ALLOWNS = True DEBUG = False +LIMITNS = False LITVARS = False +ST = False -# The default is no pre-defined symbols -st = {} - for fn in sys.argv[files:]: # Handle inline options - if fn == "debug": - DEBUG = True + if fn == "symtbl": + ST = True + + elif fn == "nonewvar": + ALLOWVAR = False + + elif fn == "limitns": + LIMITNS = True elif fn == "litvars": LITVARS = True - elif fn == "symtbl": - st = symtbl + elif fn == "debug": + DEBUG = True - elif fn == "nonewvar": - ALLOWVAR = False - - elif fn == "nonewns": - ALLOWNS = False # Everything else presumed to be a configuration file else: + + # The default is no pre-defined symbols + st = {} + + if ST: + st = symtbl + + if LIMITNS: + # Limit the number of namespaces the user can use + des = VarDescriptor() + des.Value = "NS0" # This is the initial namespace + des.LegalVals = [r"^NS.*", ] + des.Min = 3 + des.Max = 8 + st["NAMESPACE"] = des + retval = ParseConfig(fn, InitialSymTable=st, AllowNewVars=ALLOWVAR, - AllowNewNamespaces=ALLOWNS, - Debug=DEBUG, - LiteralVars=LITVARS + LiteralVars=LITVARS, + Debug=DEBUG ) if retval.Errors: