Fresco/test/syunit syn2cc.py,1.2,1.3
Nathaniel Smith <[email protected]>
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/test/syunit
In directory purcel:/tmp/cvs-serv18098
Modified Files:
syn2cc.py
Log Message:
A few tweaks so set_up/tear_down have a chance of working, and so you'll
get a warning if you try to name a test "all". Also removed a bit of
debugging code.
These changes are not tested, but hey, I know they'll work ;-).
Index: syn2cc.py
===================================================================
RCS file: /cvs/fresco/Fresco/test/syunit/syn2cc.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- syn2cc.py 19 Feb 2003 20:40:15 -0000 1.2
+++ syn2cc.py 19 Feb 2003 20:47:06 -0000 1.3
@@ -31,6 +31,12 @@
"""
test_class_root = ("SyUnit", "TestCase")
+"""Methods that should be ignored."""
+ignore_methods = ("set_up", "tear_down")
+
+"""Illegal test names."""
+bad_names = ("all")
+
test_file_tmpl = """\
/* This file was automatically generated. Do not edit! */
#include <TestCmd.hh>
@@ -109,7 +115,7 @@
file_name,
`parent_names`)
if self.base_class in parent_names:
- print "Ah-hah, gotcha!"
+ #print "Ah-hah, gotcha!"
self.in_test_class = 1
self.current_class = ParsedTestClass(class_name, file_name)
self.classes.append(self.current_class)
@@ -123,10 +129,15 @@
def visitOperation(self, node):
if not self.in_test_class:
return
+ if node.realname()[-1] in ignore_methods:
+ return
method = ParsedTestMethod(node.realname()[-1],
node.realname()[-1],
"Description goes here")
- self.current_class.add_test_method(method)
+ if method.test_name() in bad_names:
+ print "Error: bad test name %s, ignored." % method.test_name()
+ else:
+ self.current_class.add_test_method(method)
def get_classes(self):
return self.classes