Changed command line processing to allow options appear anywhere.
Made provision of Literal Line variable processing to be requested.
1 parent ec1cb6e commit d49fb3bcdff1c1b94ae8dc83998c40532171e3da
@tundra tundra authored on 21 Mar 2004
Showing 1 changed file
View
59
test-tc.py
#!/usr/bin/env python
# Copyright (c) 2003-2004 TundraWare Inc. All Rights Reserved.
 
PROGNAME = "tconfpy Test Driver"
RCSID = "$Id: test-tc.py,v 1.116 2004/03/20 10:53:09 tundra Exp $"
RCSID = "$Id: test-tc.py,v 1.117 2004/03/21 13:15:32 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
# Beginning of test driver
##########
 
files = 1
DEBUG = False
 
syms = {"foo" : 1,
"fox" : 1.0,
"bar" : "stringy",
# Make sure we got legit arguments
 
if len(sys.argv) < 2:
print BANNER
print "Usage: test-tc.py [debug] file file ..."
print "Usage: test-tc.py [debug] [litvars] file file ..."
sys.exit(1)
 
if sys.argv[1].lower() == "debug":
files = 2
DEBUG = True
 
 
# Process all the requested configuration files,
# dumping the what tconfpy returns for each one.
 
DEBUG = False
LITVARS = False
 
for fn in sys.argv[files:]:
 
retval = tconfpy.ParseConfig(fn, symtbl, debug=DEBUG)
# Handle inline options
if fn == "debug":
DEBUG = True
 
if retval[1]:
print "Errors Were Found In '%s'!" % fn
elif fn == "litvars":
LITVARS = True
# Everything else presumed to be a configuration file
else:
print "No Errors Found In '%s'!" % fn
retval = tconfpy.ParseConfig(fn, symtbl, debug=DEBUG, LiteralVars=LITVARS)
 
print
dumpreturn("SYMBOL TABLE", retval[0], isdict=True)
dumpreturn("ERRORS", retval[1])
dumpreturn("WARNINGS", retval[2])
dumpreturn("DEBUG", retval[3])
if retval[1]:
print "Errors Were Found In '%s'!" % fn
else:
print "No Errors Found In '%s'!" % fn
 
print
 
dumpreturn("SYMBOL TABLE", retval[0], isdict=True)
dumpreturn("ERRORS", retval[1])
dumpreturn("WARNINGS", retval[2])
dumpreturn("DEBUG", retval[3])
dumpreturn("LITERAL LINES", retval[4])