From cbd3113e6b0bf98637b66d1bb76d144fa120d41d Mon Sep 17 00:00:00 2001 From: Malcolm Noyes Date: Thu, 19 Dec 2013 16:25:50 +0000 Subject: [PATCH] Refactor some common code, use __LINE__ instead of __COUNTER__ where possible --- include/internal/catch_config.hpp | 185 ++++++-------------- include/internal/catch_vs_test_registry.hpp | 38 ++-- scripts/catch_conditions.py | 19 +- scripts/validateVSTests.py | 9 +- 4 files changed, 92 insertions(+), 159 deletions(-) diff --git a/include/internal/catch_config.hpp b/include/internal/catch_config.hpp index fd70a12a..b0a2d010 100644 --- a/include/internal/catch_config.hpp +++ b/include/internal/catch_config.hpp @@ -24,14 +24,12 @@ namespace CatchOverrides { - class ConfigGuard - { + class ConfigGuard { public: ConfigGuard() : origConfig(Catch::getCurrentContext().getConfig()) {} - ~ConfigGuard() - { + ~ConfigGuard() { Catch::getCurrentMutableContext().setConfig(origConfig); } const Catch::Ptr& value() const {return origConfig;} @@ -45,133 +43,20 @@ namespace CatchOverrides { enum OverrideType { OverrideUpdate, OverrideReset}; // Note: ordered; update must be before reset template - class Config - { - typedef std::map, bool> BoolLineData; - typedef std::map FileBoolLineData; - typedef std::map, int> LineData; + class ConfigLineData { + typedef std::map, T> LineData; typedef std::map FileLineData; - typedef std::multimap, std::string> StringLineData; - typedef std::map FileStringLineData; public: - bool includeSuccessfulResults(const std::string& file, int c) const - { - bool result(false); - FileBoolLineData::const_iterator it = showSuccessfulTestsData.find(file); - if( it != showSuccessfulTestsData.end() ) - { - BoolLineData::const_iterator start = it->second.begin(); - BoolLineData::const_iterator end = it->second.end(); - for( BoolLineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt ) { - const std::pair& current = lineIt->first; - if( current.second == OverrideReset ) { - if( c == current.first ) { - result = lineIt->second; - end = lineIt; - break; - } - else - start = lineIt; - } - } - for( BoolLineData::const_iterator lineIt = start; lineIt != end; ++lineIt ) { - const std::pair& current = lineIt->first; - if( current.second == OverrideUpdate ) { - if( c < current.first ) - break; - result = lineIt->second; - } - } - } - return result; - } - void insertSuccessfulResults(const std::string& file, OverrideType overRide, int c, bool v) - { - FileBoolLineData::iterator it = showSuccessfulTestsData.find(file); - if( it == showSuccessfulTestsData.end() ) - { - BoolLineData tmp; - std::pair current = std::make_pair(c, overRide); - tmp.insert(std::make_pair(current,v)); - showSuccessfulTestsData.insert(std::make_pair(file, tmp)); - } - else - { - std::pair current = std::make_pair(c, overRide); - BoolLineData::iterator lineIt = it->second.find(current); - if( lineIt == it->second.end() ) { - it->second.insert(std::make_pair(current,v)); - } - else { - lineIt->second = v; - } - } - } - bool warnAboutMissingAssertions(const std::string& file, int c) const - { - bool result(false); - FileBoolLineData::const_iterator it = missingAssertionData.find(file); - if( it != missingAssertionData.end() ) - { - BoolLineData::const_iterator start = it->second.begin(); - BoolLineData::const_iterator end = it->second.end(); - for( BoolLineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt ) { - const std::pair& current = lineIt->first; - if( current.second == OverrideReset ) { - if( c == current.first ) { - result = lineIt->second; - end = lineIt; - break; - } - else - start = lineIt; - } - } - for( BoolLineData::const_iterator lineIt = start; lineIt != end; ++lineIt ) { - const std::pair& current = lineIt->first; - if( current.second == OverrideUpdate ) { - if( c < current.first ) - break; - result = lineIt->second; - } - } - } - return result; - } - void insertMissingAssertions(const std::string& file, OverrideType overRide, int c, bool v) - { - FileBoolLineData::iterator it = missingAssertionData.find(file); - if( it == missingAssertionData.end() ) - { - BoolLineData tmp; - std::pair current = std::make_pair(c, overRide); - tmp.insert(std::make_pair(current,v)); - missingAssertionData.insert(std::make_pair(file, tmp)); - } - else - { - std::pair current = std::make_pair(c, overRide); - BoolLineData::iterator lineIt = it->second.find(current); - if( lineIt == it->second.end() ) { - it->second.insert(std::make_pair(current,v)); - } - else { - lineIt->second = v; - } - } - } - int abortAfter(const std::string& file, int c) const - { - int result(-1); - FileLineData::const_iterator it = abortAfterData.find(file); - if( it != abortAfterData.end() ) - { + T getValueForFileLine(const std::string& file, int line) const { + T result(false); + FileLineData::const_iterator it = m_data.find(file); + if( it != m_data.end() ) { LineData::const_iterator start = it->second.begin(); LineData::const_iterator end = it->second.end(); for( LineData::const_iterator lineIt = it->second.begin(); lineIt != it->second.end(); ++lineIt ) { const std::pair& current = lineIt->first; if( current.second == OverrideReset ) { - if( c == current.first ) { + if( line == current.first ) { result = lineIt->second; end = lineIt; break; @@ -183,7 +68,7 @@ namespace CatchOverrides { for( LineData::const_iterator lineIt = start; lineIt != end; ++lineIt ) { const std::pair& current = lineIt->first; if( current.second == OverrideUpdate ) { - if( c < current.first ) + if( line < current.first ) break; result = lineIt->second; } @@ -191,16 +76,17 @@ namespace CatchOverrides { } return result; } - void insertAbortAfter(const std::string& file, OverrideType overRide, int c, int v) { - FileLineData::iterator it = abortAfterData.find(file); - if( it == abortAfterData.end() ) { + void recordValueForFileLine(const std::string& file, OverrideType overRide, int line, const T& v) + { + FileLineData::iterator it = m_data.find(file); + if( it == m_data.end() ) { LineData tmp; - std::pair current = std::make_pair(c, overRide); + std::pair current = std::make_pair(line, overRide); tmp.insert(std::make_pair(current,v)); - abortAfterData.insert(std::make_pair(file, tmp)); + m_data.insert(std::make_pair(file, tmp)); } else { - std::pair current = std::make_pair(c, overRide); + std::pair current = std::make_pair(line, overRide); LineData::iterator lineIt = it->second.find(current); if( lineIt == it->second.end() ) { it->second.insert(std::make_pair(current,v)); @@ -210,6 +96,37 @@ namespace CatchOverrides { } } } + private: + FileLineData m_data; + }; + + template + class Config { + typedef std::map, bool> BoolLineData; + typedef std::map FileBoolLineData; + typedef std::map, int> LineData; + typedef std::map FileLineData; + typedef std::multimap, std::string> StringLineData; + typedef std::map FileStringLineData; + public: + bool includeSuccessfulResults(const std::string& file, int line) const { + return showSuccessfulTestsData.getValueForFileLine(file,line); + } + void insertSuccessfulResults(const std::string& file, OverrideType overRide, int line, bool v) { + showSuccessfulTestsData.recordValueForFileLine(file, overRide, line, v); + } + bool warnAboutMissingAssertions(const std::string& file, int line) const { + return missingAssertionData.getValueForFileLine(file,line); + } + void insertMissingAssertions(const std::string& file, OverrideType overRide, int line, bool v) { + missingAssertionData.recordValueForFileLine(file, overRide, line, v); + } + int abortAfter(const std::string& file, int line) const { + return abortAfterData.getValueForFileLine(file,line); + } + void insertAbortAfter(const std::string& file, OverrideType overRide, int line, int v) { + abortAfterData.recordValueForFileLine(file, overRide, line, v); + } std::vector listOfTests(const std::string& file, int c) const { std::vector result; FileStringLineData::const_iterator it = testData.find(file); @@ -258,9 +175,9 @@ namespace CatchOverrides { return *s_instance; } private: - FileBoolLineData showSuccessfulTestsData; - FileBoolLineData missingAssertionData; - FileLineData abortAfterData; + ConfigLineData showSuccessfulTestsData; + ConfigLineData missingAssertionData; + ConfigLineData abortAfterData; FileStringLineData testData; static Config* s_instance; diff --git a/include/internal/catch_vs_test_registry.hpp b/include/internal/catch_vs_test_registry.hpp index 0636aefb..d2e80d61 100644 --- a/include/internal/catch_vs_test_registry.hpp +++ b/include/internal/catch_vs_test_registry.hpp @@ -251,16 +251,16 @@ private: #define INTERNAL_CATCH_CONCAT_LINE_COUNTER( count ) INTERNAL_CATCH_UNIQUE_NAME_LINE( INTERNAL_CATCH_UNIQUE_NAME_LINE( __LINE__, _ ), count ) #define CATCH_INTERNAL_CONFIG_SHOW_SUCCESS2( v, Count ) \ - namespace { CatchOverrides::ConfigShowSuccessfulTests INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, v); } + namespace { CatchOverrides::ConfigShowSuccessfulTests INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, v); } #define CATCH_INTERNAL_CONFIG_WARN_MISSING_ASSERTIONS2( v, Count ) \ - namespace { CatchOverrides::ConfigWarnMissingAssertions INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, v); } + namespace { CatchOverrides::ConfigWarnMissingAssertions INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, v); } #define CATCH_INTERNAL_CONFIG_ABORT_AFTER2( v, Count ) \ - namespace { CatchOverrides::ConfigAbortAfter INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, v); } + namespace { CatchOverrides::ConfigAbortAfter INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, v); } #define CATCH_INTERNAL_CONFIG_ADD_TEST2( v, Count ) \ - namespace { CatchOverrides::ConfigAddTest INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, v); } + namespace { CatchOverrides::ConfigAddTest INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H_____O_V_E_R_R_I_D_E____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, v); } #define CATCH_INTERNAL_CONFIG_SHOW_SUCCESS( v ) \ CATCH_INTERNAL_CONFIG_SHOW_SUCCESS2( v, __COUNTER__) @@ -278,9 +278,9 @@ private: { CatchOverrides::ConfigGuard cg; \ Catch::ConfigData cd(cg.value().get()); \ cd.name = name_desc.name; \ - cd.showSuccessfulTests = CatchOverrides::Config::instance().includeSuccessfulResults(__FILE__, Count ); \ - cd.warnings = (CatchOverrides::Config::instance().warnAboutMissingAssertions(__FILE__, Count ) ? Catch::WarnAbout::NoAssertions : Catch::WarnAbout::Nothing); \ - cd.abortAfter = CatchOverrides::Config::instance().abortAfter(__FILE__, Count ); \ + cd.showSuccessfulTests = CatchOverrides::Config::instance().includeSuccessfulResults(__FILE__, __LINE__ ); \ + cd.warnings = (CatchOverrides::Config::instance().warnAboutMissingAssertions(__FILE__, __LINE__ ) ? Catch::WarnAbout::NoAssertions : Catch::WarnAbout::Nothing); \ + cd.abortAfter = CatchOverrides::Config::instance().abortAfter(__FILE__, __LINE__ ); \ Catch::Ptr config(new Catch::Config(cd)); \ Catch::ReporterRegistrar reporterReg("vs_reporter"); \ Catch::RunContext context(config.get(), Catch::getRegistryHub().getReporterRegistry().create( "vs_reporter", config.get())); \ @@ -300,7 +300,7 @@ private: static void INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(); \ namespace CATCH_INTERNAL_NAMESPACE( INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) { \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( & INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ), CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc(CATCH_INTERNAL_HANDLE_EMPTY_PARAM(Name), Desc) ); \ - CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, 1); \ + CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, 1); \ INTERNAL_CATCH_CLASS_DEFINITION( INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_L_A_S_S___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) ) \ { \ INTERNAL_CATCH_CLASS_CONTEXT \ @@ -313,7 +313,7 @@ private: CHECK_FOR_TEST_CASE_CLASH \ namespace CATCH_INTERNAL_NAMESPACE( INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) { \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( & QualifiedMethod, "&" # QualifiedMethod, Catch::NameAndDesc(CATCH_INTERNAL_HANDLE_EMPTY_PARAM(Name), Desc), CATCH_INTERNAL_LINEINFO ); \ - CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, 1); \ + CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, 1); \ INTERNAL_CATCH_CLASS_DEFINITION( INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_L_A_S_S___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) ) \ { \ INTERNAL_CATCH_CLASS_CONTEXT \ @@ -329,7 +329,7 @@ private: }; \ namespace CATCH_INTERNAL_NAMESPACE( INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) { \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( & INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )::invoke, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc(CATCH_INTERNAL_HANDLE_EMPTY_PARAM(TestName), Desc) ); \ - CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, 1); \ + CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, 1); \ INTERNAL_CATCH_CLASS_DEFINITION( INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_L_A_S_S___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) ) \ { \ INTERNAL_CATCH_CLASS_CONTEXT \ @@ -362,16 +362,16 @@ private: #define INTERNAL_CATCH_MAP_CATEGORY_TO_TAG2( Category, Tag, Count ) \ CHECK_FOR_TEST_CASE_CLASH \ namespace CATCH_INTERNAL_NAMESPACE( INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) { \ - CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, -1); \ + CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, -1); \ INTERNAL_CATCH_CLASS_DEFINITION( INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_L_A_S_S___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) ) \ { \ INTERNAL_CATCH_CLASS_CONTEXT \ BEGIN_INTERNAL_CATCH_BATCH_METHOD( Category, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) \ { \ Catch::ConfigData cd; \ - cd.showSuccessfulTests = CatchOverrides::Config::instance().includeSuccessfulResults(__FILE__, Count ); \ - cd.warnings = (CatchOverrides::Config::instance().warnAboutMissingAssertions(__FILE__, Count ) ? Catch::WarnAbout::NoAssertions : Catch::WarnAbout::Nothing); \ - cd.abortAfter = CatchOverrides::Config::instance().abortAfter(__FILE__, Count ); \ + cd.showSuccessfulTests = CatchOverrides::Config::instance().includeSuccessfulResults(__FILE__, __LINE__ ); \ + cd.warnings = (CatchOverrides::Config::instance().warnAboutMissingAssertions(__FILE__, __LINE__ ) ? Catch::WarnAbout::NoAssertions : Catch::WarnAbout::Nothing); \ + cd.abortAfter = CatchOverrides::Config::instance().abortAfter(__FILE__, __LINE__ ); \ cd.reporterName = "vs_reporterlf"; \ cd.name = "Batch run using tag : " Tag; \ cd.testsOrTags.push_back( Tag ); \ @@ -389,19 +389,19 @@ private: #define INTERNAL_CATCH_MAP_CATEGORY_TO_LIST2( Category, CategoryName, Count ) \ CHECK_FOR_TEST_CASE_CLASH \ namespace CATCH_INTERNAL_NAMESPACE( INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) { \ - CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, Count, -1); \ + CatchOverrides::ConfigReset INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_O_N_F_I_G___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) )(__FILE__, __LINE__, -1); \ INTERNAL_CATCH_CLASS_DEFINITION( INTERNAL_CATCH_UNIQUE_NAME_LINE( C_A_T_C_H____T_E_S_T____C_L_A_S_S___, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) ) \ { \ INTERNAL_CATCH_CLASS_CONTEXT \ BEGIN_INTERNAL_CATCH_BATCH_METHOD( Category, INTERNAL_CATCH_CONCAT_LINE_COUNTER( Count ) ) \ { \ Catch::ConfigData cd; \ - cd.showSuccessfulTests = CatchOverrides::Config::instance().includeSuccessfulResults(__FILE__, Count ); \ - cd.warnings = (CatchOverrides::Config::instance().warnAboutMissingAssertions(__FILE__, Count ) ? Catch::WarnAbout::NoAssertions : Catch::WarnAbout::Nothing); \ - cd.abortAfter = CatchOverrides::Config::instance().abortAfter(__FILE__, Count ); \ + cd.showSuccessfulTests = CatchOverrides::Config::instance().includeSuccessfulResults(__FILE__, __LINE__ ); \ + cd.warnings = (CatchOverrides::Config::instance().warnAboutMissingAssertions(__FILE__, __LINE__ ) ? Catch::WarnAbout::NoAssertions : Catch::WarnAbout::Nothing); \ + cd.abortAfter = CatchOverrides::Config::instance().abortAfter(__FILE__, __LINE__ ); \ cd.reporterName = "vs_reporterlf"; \ cd.name = "Batch run using category : " CategoryName; \ - std::vector stringNames = CatchOverrides::Config::instance().listOfTests(__FILE__, Count ); \ + std::vector stringNames = CatchOverrides::Config::instance().listOfTests(__FILE__, __LINE__ ); \ Catch::Ptr config(new Catch::Config(cd)); \ Catch::ReporterRegistrar reporterReg("vs_reporterlf"); \ Catch::RunContext context(config.get(), Catch::getRegistryHub().getReporterRegistry().create( "vs_reporterlf", config.get())); \ diff --git a/scripts/catch_conditions.py b/scripts/catch_conditions.py index e7cc87b1..4dfb6962 100644 --- a/scripts/catch_conditions.py +++ b/scripts/catch_conditions.py @@ -134,7 +134,14 @@ class TestConditionData: if not(reasonOnSameLine) and len(self.reason): lines.append(self.reason) if len(self.condition): - lines.append(" " + self.condition) + line = self.condition + m = self.hexParser.match(line) + if m: + while m: + line = m.group(1) + "0x" + m.group(3) + m = self.hexParser.match(line) + line = line.replace("__null","0") + lines.append(" " + line) if len(self.expansionPrefix): lines.append(self.expansionPrefix) extraLine = True @@ -145,6 +152,7 @@ class TestConditionData: while m: line = m.group(1) + "0x" + m.group(3) m = self.hexParser.match(line) + line = line.replace("__null","0") lines.append(" " + line) if len(self.messagePrefix): lines.append(self.messagePrefix) @@ -223,7 +231,14 @@ class TestConditionData: if not(reasonOnSameLine) and len(self.reason): lines.append(self.reason) if len(self.condition): - lines.append(" " + self.condition) + line = self.condition + m = self.hexParser.match(line) + if m: + while m: + line = m.group(1) + "0x" + m.group(3) + m = self.hexParser.match(line) + line = line.replace("Catch::Text","Text") + lines.append(" " + line) if len(self.expansionPrefix): lines.append(self.expansionPrefix) extraLine = True diff --git a/scripts/validateVSTests.py b/scripts/validateVSTests.py index 8938d063..e1b626e5 100644 --- a/scripts/validateVSTests.py +++ b/scripts/validateVSTests.py @@ -44,8 +44,8 @@ def approve( baseName, args ): rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) ) if os.path.exists( baselinesPath ): approvedFileHandler = TestRunApprovedHandler(baselinesPath) - baselinesPathNew = os.path.join( rootPath, '{0}.approved.new.txt'.format( baseName ) ) - approvedFileHandler.writeRawFile(baselinesPathNew) + #baselinesPathNew = os.path.join( rootPath, '{0}.approved.new.txt'.format( baseName ) ) + #approvedFileHandler.writeRawFile(baselinesPathNew) approvedFileHandler.writeSortedRawFile(baselinesSortedPath) else: raise Exception("Base file does not exist: '" + baselinesPath + "'") @@ -59,11 +59,12 @@ def approve( baseName, args ): if os.path.exists( rawResultsPath ): resultFileHandler = TestRunResultHandler(rawResultsPath) - rawPathNew = os.path.join( rootPath, '{0}.rewrite.txt'.format( baseName ) ) + #rawPathNew = os.path.join( rootPath, '{0}.rewrite.txt'.format( baseName ) ) #print "F:",rawPathNew,",",approvedFileHandler.current.outputLine - resultFileHandler.writeRawFile(rawPathNew) + #resultFileHandler.writeRawFile(rawPathNew) rawPathNewSorted = os.path.join( rootPath, '{0}.sorted.unapproved.txt'.format( baseName ) ) resultFileHandler.writeSortedUnapprovedFile(rawPathNewSorted, approvedFileHandler.current.outputLine) + os.remove( rawResultsPath ) else: raise Exception("Results file does not exist: '" + rawResultsPath + "'")