Skip to content

Commit

Permalink
Merge remote-tracking branch 'abatyiev/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
whart222 committed Nov 11, 2012
2 parents 21ea5ce + eeb1317 commit ea09c5f
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions python/cxxtest/cxxtestgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,13 @@ def writeSuites(output):
writeInclude( output, suite['file'] )
if isGenerated(suite):
generateSuite( output, suite )
if isDynamic(suite):
writeSuitePointer( output, suite )
else:
writeSuiteObject( output, suite )
writeTestList( output, suite )
writeSuiteDescription( output, suite )
if not options.noStaticInit:
if isDynamic(suite):
writeSuitePointer( output, suite )
else:
writeSuiteObject( output, suite )
writeTestList( output, suite )
writeSuiteDescription( output, suite )
writeTestDescriptions( output, suite )

def isGenerated(suite):
Expand Down Expand Up @@ -424,13 +425,24 @@ def writeTestDescriptions( output, suite ):

def writeTestDescription( output, suite, test ):
'''Write test description object'''
output.write( 'static class %s : public CxxTest::RealTestDescription {\n' % test['class'] )
if not options.noStaticInit:
output.write( 'static class %s : public CxxTest::RealTestDescription {\n' % test['class'] )
else:
output.write( 'class %s : public CxxTest::RealTestDescription {\n' % test['class'] )

output.write( 'public:\n' )
if not options.noStaticInit:
output.write( ' %s() : CxxTest::RealTestDescription( %s, %s, %s, "%s" ) {}\n' %
(test['class'], suite['tlist'], suite['dobject'], test['line'], test['name']) )
output.write( ' void runTest() { %s }\n' % runBody( suite, test ) )
output.write( '} %s;\n\n' % test['object'] )
if options.noStaticInit:
output.write( ' %s(%s &%s) : %s(%s) { }\n' %
(test['class'], suite['name'], suite['object'], suite['object'], suite['object']) )
output.write( ' %s &%s;\n' % (suite['name'], suite['object']) )
if not options.noStaticInit:
output.write( '} %s;\n\n' % test['object'] )
else:
output.write( '};\n\n' )

def runBody( suite, test ):
'''Body of TestDescription::run()'''
Expand Down Expand Up @@ -479,6 +491,10 @@ def writeInitialize(output):
output.write( ' void initialize()\n' )
output.write( ' {\n' )
for suite in suites:
writeTestList( output, suite )
writeSuiteObject( output, suite )
output.write( ' static ')
writeSuiteDescription( output, suite )
output.write( ' %s.initialize();\n' % suite['tlist'] )
if isDynamic(suite):
output.write( ' %s = 0;\n' % suite['object'] )
Expand All @@ -491,6 +507,8 @@ def writeInitialize(output):
suite['object'], suite['tlist']) )

for test in suite['tests']:
output.write( ' static %s %s(%s);\n' %
(test['class'], test['object'], suite['object']) )
output.write( ' %s.initialize( %s, %s, %s, "%s" );\n' %
(test['object'], suite['tlist'], suite['dobject'], test['line'], test['name']) )

Expand Down

0 comments on commit ea09c5f

Please sign in to comment.