test/gtest_firstpass.py
author Krista 'DarthMama' Bennett <krista@pep.foundation>
Fri, 29 May 2020 14:57:14 +0200
branchsync
changeset 4720 de3a945ae12b
parent 4170 14e0ece2e488
child 4973 48a379cf24ff
permissions -rw-r--r--
cross-branch test contamination maybe?
krista@3998
     1
import re 
krista@3999
     2
import sys
krista@4016
     3
import os
krista@3999
     4
krista@4010
     5
def tb(n):
krista@4010
     6
    retval = ""
krista@4010
     7
    for i in range(n):
krista@4010
     8
        retval = retval + "    "
krista@4010
     9
    return retval
krista@4010
    10
        
krista@4016
    11
#filename = sys.argv[1]
krista@4016
    12
#outfile = sys.argv[2]
krista@3999
    13
krista@4016
    14
for filename in os.listdir("src"):
krista@4016
    15
    fixture_in = False 
krista@4016
    16
    removing_old_constructor = False
krista@4016
    17
    constructor_done = False
krista@4016
    18
    modline = None
krista@4016
    19
    eat_next_line = False;
krista@4016
    20
    
krista@4016
    21
    if not filename.endswith("Tests.cc"):
krista@4016
    22
        continue
krista@4016
    23
        
krista@4016
    24
    outfile = filename[:-4] + ".cc"
krista@4016
    25
    
krista@4016
    26
    print("Output file is " + outfile)
krista@4016
    27
        
krista@4016
    28
    newfile = open(os.path.join("src", outfile),'w')
krista@3999
    29
krista@4016
    30
    with open(os.path.join("src", filename)) as fp: 
krista@4016
    31
        for line in fp:
krista@4016
    32
            if (eat_next_line):
krista@4016
    33
                eat_next_line = False;
krista@4016
    34
                continue;
krista@4016
    35
            line = line.rstrip();
krista@4016
    36
            
krista@4016
    37
            if not fixture_in:
krista@4016
    38
                if (removing_old_constructor):
krista@4016
    39
                    if "}" in line:
krista@4016
    40
                        removing_old_constructor = False  
krista@4016
    41
                        constructor_done = True 
krista@3999
    42
                    continue
krista@4016
    43
                else:        
krista@4016
    44
                    if (line.find("namespace") >= 0):
krista@4016
    45
                        continue
krista@4016
    46
                    if (line.find("Tests.h") >= 0):
krista@4016
    47
                        continue
krista@4016
    48
                    if (line.find("cpptest") >= 0):
krista@4016
    49
                        continue 
krista@4016
    50
                    if (line.find("EngineTestSuite.h") >= 0 or line.find("EngineTestIndividualSuite.h") >= 0 or line.find("EngineTestSessionSuite.h") >= 0):
krista@4016
    51
                        continue
krista@4016
    52
                    
krista@4016
    53
                    if (modline == None):                
krista@4016
    54
                        modline = re.sub(r'(.*)Tests::(.*)Tests\(string suitename, string test_home_dir\) :', r'\1Test', line)                
krista@4016
    55
                        
krista@4016
    56
                    if(modline == line):
krista@4016
    57
                        newfile.write(line + "\n")
krista@4016
    58
                        modline = None
krista@4016
    59
                        continue
krista@4016
    60
                    else:
krista@4016
    61
                        if not (constructor_done):
krista@4016
    62
                            removing_old_constructor = True
krista@4016
    63
                            continue    
krista@4016
    64
                            
krista@4016
    65
                        #*Tests::*Tests(string suitename, string test_home_dir)
krista@4016
    66
                        # Put in fixture blob
krista@4016
    67
                        # - delete through first }
krista@4016
    68
                        #print(modline) 
krista@4016
    69
                        newfile.write("#include \"Engine.h\"\n\n")                    
krista@4016
    70
                        newfile.write("#include <gtest/gtest.h>\n\n\n")
krista@4016
    71
                        newfile.write("namespace {\n\n\t//The fixture for " + modline + "\n")
krista@4016
    72
                        newfile.write(tb(1) + "class " + modline + " : public ::testing::Test {\n")
krista@4016
    73
                        newfile.write(tb(2) + "public:\n")
krista@4016
    74
                        newfile.write(tb(3) + "Engine* engine;\n")
krista@4016
    75
                        newfile.write(tb(3) + "PEP_SESSION session;\n\n")
krista@4016
    76
                        newfile.write(tb(2) + "protected:\n")
krista@4016
    77
                        newfile.write(tb(3) + "// You can remove any or all of the following functions if its body\n")
krista@4016
    78
                        newfile.write(tb(3) + "// is empty.\n")
krista@4016
    79
                        newfile.write(tb(3) + "" + modline + "() {\n")
krista@4016
    80
                        newfile.write(tb(4) + "// You can do set-up work for each test here.\n")
krista@4170
    81
                        newfile.write(tb(4) + "test_suite_name = ::testing::UnitTest::GetInstance()->current_test_info()->GTEST_SUITE_SYM();\n")
krista@4016
    82
                        newfile.write(tb(4) + "test_name = ::testing::UnitTest::GetInstance()->current_test_info()->name();\n")
krista@4016
    83
                        newfile.write(tb(4) + "test_path = get_main_test_home_dir() + \"/\" + test_suite_name + \"/\" + test_name;\n")
krista@4016
    84
                        newfile.write(tb(3) + "}\n\n")
krista@4016
    85
                        newfile.write(tb(3) + "~" + modline + "() override {\n")
krista@4016
    86
                        newfile.write(tb(4) + "// You can do clean-up work that doesn't throw exceptions here.\n")
krista@4016
    87
                        newfile.write(tb(3) + "}\n\n")
krista@4016
    88
                        newfile.write(tb(3) + "// If the constructor and destructor are not enough for setting up\n")
krista@4016
    89
                        newfile.write(tb(3) + "// and cleaning up each test, you can define the following methods:\n\n")
krista@4016
    90
                        newfile.write(tb(3) + "void SetUp() override {\n")
krista@4016
    91
                        newfile.write(tb(4) + "// Code here will be called immediately after the constructor (right\n")
krista@4016
    92
                        newfile.write(tb(4) + "// before each test).\n")
krista@4016
    93
                        newfile.write("\n" + tb(4) + "// Leave this empty if there are no files to copy to the home directory path\n")
krista@4016
    94
                        newfile.write(tb(4) + "std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>();\n")                                        
krista@4016
    95
                        newfile.write("\n" + tb(4) + "// Get a new test Engine.\n")                    
krista@4016
    96
                        newfile.write(tb(4) + "engine = new Engine(test_path);\n");
krista@4016
    97
                        newfile.write(tb(4) + "ASSERT_NE(engine, nullptr);\n")
krista@4016
    98
                        newfile.write("\n" + tb(4) + "// Ok, let's initialize test directories etc.\n")                                        
krista@4016
    99
                        newfile.write(tb(4) + "engine->prep(NULL, NULL, init_files);\n")
krista@4016
   100
                        newfile.write("\n" + tb(4) + "// Ok, try to start this bugger.\n")                    
krista@4016
   101
                        newfile.write(tb(4) + "engine->start();\n")                    
krista@4016
   102
                        newfile.write(tb(4) + "ASSERT_NE(engine->session, nullptr);\n")                    
krista@4016
   103
                        newfile.write(tb(4) + "session = engine->session;\n") 
krista@4016
   104
                        newfile.write("\n" + tb(4) + "// Engine is up. Keep on truckin\'\n");                                                            
krista@4016
   105
                        newfile.write(tb(3) + "}\n\n")
krista@4016
   106
                        newfile.write(tb(3) + "void TearDown() override {\n")
krista@4016
   107
                        newfile.write(tb(4) + "// Code here will be called immediately after each test (right\n")
krista@4016
   108
                        newfile.write(tb(4) + "// before the destructor).\n")   
krista@4016
   109
                        newfile.write(tb(4) + "engine->shut_down();\n")
krista@4016
   110
                        newfile.write(tb(4) + "delete engine;\n")                    
krista@4016
   111
                        newfile.write(tb(4) + "engine = NULL;\n")                    
krista@4016
   112
                        newfile.write(tb(4) + "session = NULL;\n")                    
krista@4016
   113
                        newfile.write(tb(3) + "}\n\n")
krista@4016
   114
                        newfile.write(tb(2) + "private:\n");
krista@4016
   115
                        newfile.write(tb(3) + "const char* test_suite_name;\n")
krista@4016
   116
                        newfile.write(tb(3) + "const char* test_name;\n")                                                            
krista@4016
   117
                        newfile.write(tb(3) + "string test_path;\n") 
krista@4016
   118
                        newfile.write(tb(3) + "// Objects declared here can be used by all tests in the " + modline + " suite.\n\n")
krista@4016
   119
                        newfile.write(tb(1) + "};\n\n")
krista@4016
   120
                        newfile.write("}  // namespace\n\n\n")
krista@4016
   121
krista@4016
   122
                        fixture_in = True
krista@4016
   123
            else:
krista@4016
   124
                #void *Tests::check*() {
krista@4016
   125
                # -> TEST_F(*Test, check*) {
krista@4016
   126
                modline = re.sub(r'void\s*(.*)Tests::check(.*)\(\)\s*{', r'TEST_F(\1Test, check\2) {', line)
krista@4016
   127
                if (line != modline):
krista@4016
   128
                    newfile.write(modline + "\n")
krista@3999
   129
                    continue
krista@4016
   130
                    
krista@4016
   131
                #TEST_ASSERT(true)
krista@4016
   132
                # -> <nothing>                
krista@4016
   133
                if (line.find("TEST_ASSERT(true)") >= 0):
krista@4016
   134
                    continue
krista@4016
   135
                    
krista@4016
   136
                #TEST_ASSERT_MSG(strcmp(blah,blah) == 0, *)
krista@4016
   137
                #TEST_ASSERT(strcmp(blah,blah == 0))
krista@4016
   138
                # -> ASSERT_STREQ(blah,blah)
krista@4016
   139
                modline = re.sub(r'TEST_ASSERT_MSG\(\s*strcmp\(\s*(.*),\s*(.*)\)\s*==\s*0\s*,.*\);', r'ASSERT_STREQ(\1, \2);', line)
krista@4016
   140
                if (line != modline):
krista@4016
   141
                    newfile.write(modline + "\n")
krista@4016
   142
                    continue
krista@4016
   143
                modline = re.sub(r'TEST_ASSERT\(\s*strcmp\(\s*(.*),\s*(.*)\)\s*==\s*0\);', r'ASSERT_STREQ(\1, \2);', line)
krista@4016
   144
                if (line != modline):
krista@4016
   145
                    newfile.write(modline + "\n")
krista@4016
   146
                    continue
krista@4016
   147
krista@4016
   148
                #TEST_ASSERT_MSG(strcmp(blah,blah) != 0, *)
krista@4016
   149
                #TEST_ASSERT(strcmp(blah,blah != 0))
krista@4016
   150
                # -> ASSERT_STREQ(blah,blah)
krista@4016
   151
                modline = re.sub(r'TEST_ASSERT_MSG\(\s*strcmp\(\s*(.*),\s*(.*)\)\s*!=\s*0\s*,.*\);', r'ASSERT_STRNE(\1, \2);', line)
krista@4016
   152
                if (line != modline):
krista@4016
   153
                    newfile.write(modline + "\n")
krista@4016
   154
                    continue
krista@4016
   155
                modline = re.sub(r'TEST_ASSERT\(\s*strcmp\(\s*(.*),\s*(.*)\)\s*!=\s*0\);', r'ASSERT_STRNE(\1, \2);', line)
krista@4016
   156
                if (line != modline):
krista@4016
   157
                    newfile.write(modline + "\n")
krista@4016
   158
                    continue
krista@4016
   159
                    
krista@4016
   160
                #TEST_ASSERT_MSG(<x> == NULL, *);
krista@4016
   161
                #TEST_ASSERT(<x> == NULL);
krista@4016
   162
                # -> ASSERT_EQ(<x>, nullptr);
krista@4016
   163
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*==\s*NULL,.*\);',r'ASSERT_EQ(\1, nullptr);', line)
krista@4016
   164
                if (line != modline):
krista@4016
   165
                    newfile.write(modline + "\n")
krista@4016
   166
                    continue
krista@4016
   167
                modline = re.sub(r'TEST_ASSERT\((.*)\s*==\s*NULL\);', r'ASSERT_EQ(\1, nullptr);',line)
krista@4016
   168
                if (line != modline):
krista@4016
   169
                    newfile.write(modline + "\n")
krista@3999
   170
                    continue
krista@3999
   171
                
krista@4016
   172
                #TEST_ASSERT_MSG(<x> != NULL, *);
krista@4016
   173
                #TEST_ASSERT(<x> != NULL);
krista@4016
   174
                # -> ASSERT_NE(<x>, nullptr);
krista@4016
   175
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*!=\s*NULL,.*\);',r'ASSERT_NE(\1, nullptr);', line)
krista@4016
   176
                if (line != modline):
krista@4016
   177
                    newfile.write(modline + "\n")
krista@4016
   178
                    continue
krista@4016
   179
                modline = re.sub(r'TEST_ASSERT\((.*)\s*!=\s*NULL\);', r'ASSERT_NE(\1, nullptr);',line)
krista@4016
   180
                if (line != modline):
krista@4016
   181
                    newfile.write(modline + "\n")
krista@4016
   182
                    continue
krista@4016
   183
                
krista@4016
   184
                #TEST_ASSERT_MSG(<x> == <y>, *);
krista@4016
   185
                #TEST_ASSERT(<x> == <y>);
krista@4016
   186
                # -> ASSERT_EQ(<x>, <y>);
krista@4016
   187
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*==\s*(.*),.*\);', r'ASSERT_EQ(\1, \2);',line)
krista@4016
   188
                if (line != modline):
krista@4016
   189
                    newfile.write(modline + "\n")
krista@4016
   190
                    continue
krista@4016
   191
                modline = re.sub(r'TEST_ASSERT\((.*)\s*==\s*(.*)\);', r'ASSERT_EQ(\1, \2);',line)
krista@4016
   192
                if (line != modline):
krista@4016
   193
                    newfile.write(modline + "\n")
krista@4016
   194
                    continue
krista@4016
   195
                
krista@4016
   196
                #TEST_ASSERT_MSG(<x> != <y>, *);
krista@4016
   197
                #TEST_ASSERT(<x> != <y>);
krista@4016
   198
                # -> ASSERT_NE(<x>, <y>);
krista@4016
   199
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*!=\s*(.*),.*\);', r'ASSERT_NE(\1, \2);',line)
krista@4016
   200
                if (line != modline):
krista@4016
   201
                    newfile.write(modline + "\n")
krista@4016
   202
                    continue
krista@4016
   203
                modline = re.sub(r'TEST_ASSERT\((.*)\s*!=\s*(.*)\);', r'ASSERT_NE(\1, \2);',line)
krista@4016
   204
                if (line != modline):
krista@4016
   205
                    newfile.write(modline + "\n")
krista@3999
   206
                    continue
krista@4016
   207
                
krista@4016
   208
                #TEST_ASSERT_MSG(<x> >= <y>, *);
krista@4016
   209
                #TEST_ASSERT(<x> >= <y>);
krista@4016
   210
                # -> ASSERT_GE(<x>, <y>);
krista@4016
   211
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*[^-]>=\s*(.*),.*\);', r'ASSERT_GE(\1, \2);',line)
krista@4016
   212
                if (line != modline):
krista@4016
   213
                    newfile.write(modline + "\n")
krista@4016
   214
                    continue
krista@4016
   215
                modline = re.sub(r'TEST_ASSERT\((.*)\s*[^-]>=\s*(.*)\);', r'ASSERT_GE(\1, \2);',line)
krista@4016
   216
                if (line != modline):
krista@4016
   217
                    newfile.write(modline + "\n")
krista@4016
   218
                    continue
krista@3999
   219
                
krista@4016
   220
                #TEST_ASSERT_MSG(<x> > <y>, *);
krista@4016
   221
                #TEST_ASSERT(<x> > <y>);
krista@4016
   222
                # -> ASSERT_GT(<x>, <y>);
krista@4016
   223
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*[^-]>\s*(.*),.*\);', r'ASSERT_GT(\1, \2);',line)
krista@4016
   224
                if (line != modline):
krista@4016
   225
                    newfile.write(modline + "\n")
krista@4016
   226
                    continue
krista@4016
   227
                modline = re.sub(r'TEST_ASSERT\((.*)\s*[^-]>\s*(.*)\);', r'ASSERT_GT(\1, \2);',line)
krista@4016
   228
                if (line != modline):
krista@4016
   229
                    newfile.write(modline + "\n")
krista@4016
   230
                    continue
krista@3999
   231
                
krista@4016
   232
                #TEST_ASSERT_MSG(<x> <= <y>, *);
krista@4016
   233
                #TEST_ASSERT(<x> <= <y>);
krista@4016
   234
                # -> ASSERT_LE(<x>, <y>);
krista@4016
   235
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*<=\s*(.*),.*\);', r'ASSERT_LE(\1, \2);',line)
krista@4016
   236
                if (line != modline):
krista@4016
   237
                    newfile.write(modline + "\n")
krista@4016
   238
                    continue
krista@4016
   239
                modline = re.sub(r'TEST_ASSERT\((.*)\s*<=\s*(.*)\);', r'ASSERT_LE(\1, \2);',line)
krista@4016
   240
                if (line != modline):
krista@4016
   241
                    newfile.write(modline + "\n")
krista@4016
   242
                    continue
krista@3999
   243
                
krista@4016
   244
                #TEST_ASSERT_MSG(<x> < <y>, *);
krista@4016
   245
                #TEST_ASSERT(<x> < <y>);
krista@4016
   246
                # -> ASSERT_LT(<x>, <y>);
krista@4016
   247
                modline = re.sub(r'TEST_ASSERT_MSG\((.*)\s*<\s*(.*),.*\);', r'ASSERT_LT(\1, \2);',line)
krista@4016
   248
                if (line != modline):
krista@4016
   249
                    newfile.write(modline + "\n")
krista@4016
   250
                    continue
krista@4016
   251
                modline = re.sub(r'TEST_ASSERT\((.*)\s*<\s*(.*)\);', r'ASSERT_LT(\1, \2);',line)
krista@4016
   252
                if (line != modline):
krista@4016
   253
                    newfile.write(modline + "\n")
krista@4016
   254
                    continue
krista@4010
   255
krista@4016
   256
                #TEST_ASSERT_MSG(slurp_and_import_key(
krista@4016
   257
                #TEST_ASSERT(slurp_and_import_key(
krista@4016
   258
                # -> ASSERT_TRUE(slurp_and_import_key(
krista@4016
   259
                modline = re.sub(r'TEST_ASSERT_MSG\(slurp_and_import_key', r'ASSERT_TRUE(slurp_and_import_key',line)
krista@4016
   260
                if (line != modline):
krista@4016
   261
                    if not line.endswith(";"):
krista@4016
   262
                        eat_next_line = True
krista@4016
   263
                        modline = re.sub(r'\),', r'));', modline);
krista@4016
   264
                    newfile.write(modline + "\n")
krista@4016
   265
                    continue
krista@4016
   266
                modline = re.sub(r'TEST_ASSERT\(slurp_and_import_key', r'ASSERT_TRUE(slurp_and_import_key',line)
krista@4016
   267
                if (line != modline):
krista@4016
   268
                    newfile.write(modline + "\n")
krista@4016
   269
                    continue
krista@4016
   270
                
krista@4016
   271
                #TEST_ASSERT_MSG(!<x>, *);
krista@4016
   272
                #TEST_ASSERT(!<x>);
krista@4016
   273
                # -> ASSERT_FALSE(<x>);
krista@4016
   274
                mgroup = re.match(r'TEST_ASSERT_MSG\(!(.*),.*\);', line.lstrip());
krista@4016
   275
                if (mgroup == None):
krista@4016
   276
                    mgroup = re.match(r'TEST_ASSERT\(!(.*)\);', line.lstrip());
krista@3999
   277
                
krista@4016
   278
                if (mgroup != None):
krista@4016
   279
                    matchphrase = mgroup.group(0)
krista@4016
   280
                    is_pointer = False
krista@4016
   281
                    while True:
krista@4016
   282
                        answer = input("ATTENTION: INPUT REQUIRED: In line " + line.lstrip() + ", is " + matchphrase + " a pointer? (y/n)")
krista@4016
   283
                        if (answer == "y" or answer == "Y"):
krista@4016
   284
                            is_pointer = True
krista@4016
   285
                            break
krista@4016
   286
                        elif (answer != "n" and answer != 'N'):
krista@4016
   287
                            print("\'" + answer + "\' is not a valid answer. Please answer with 'y' or 'n'.") 
krista@4016
   288
                            continue
krista@4016
   289
                        break;       
krista@4016
   290
                    
krista@4016
   291
                    if (is_pointer):
krista@4016
   292
                        modline = re.sub(r'TEST_ASSERT_MSG\(!(.*),.*\);',r'ASSERT_NE(\1, nullptr);', line)
krista@4016
   293
                        if (line != modline):
krista@4016
   294
                            newfile.write(modline + "\n")
krista@4016
   295
                            continue
krista@4016
   296
                        modline = re.sub(r'TEST_ASSERT\(!(.*)\);', r'ASSERT_NE(\1, nullptr);',line)
krista@4016
   297
                        if (line != modline):
krista@4016
   298
                            newfile.write(modline + "\n")
krista@4016
   299
                            continue
krista@4016
   300
                    else:        
krista@4016
   301
                        modline = re.sub(r'TEST_ASSERT_MSG\(!(.*),.*\);',r'ASSERT_FALSE(\1);', line)
krista@4016
   302
                        if (line != modline):
krista@4016
   303
                            newfile.write(modline + "\n")
krista@4016
   304
                            continue
krista@4016
   305
                        modline = re.sub(r'TEST_ASSERT\(!(.*)\);', r'ASSERT_FALSE(\1);',line)
krista@4016
   306
                        if (line != modline):
krista@4016
   307
                            newfile.write(modline + "\n")
krista@4016
   308
                            continue
krista@4016
   309
                                                
krista@4016
   310
                #TEST_ASSERT_MSG(<x>, *);
krista@4016
   311
                #TEST_ASSERT(<x>);
krista@4016
   312
                # -> ASSERT_TRUE(<x>);
krista@4016
   313
                mgroup = re.match(r'TEST_ASSERT_MSG\((.*),.*\);', line.lstrip());
krista@4016
   314
                if (mgroup == None):
krista@4016
   315
                    mgroup = re.match(r'TEST_ASSERT\((.*)\);', line.lstrip());
krista@3999
   316
                
krista@4016
   317
                if (mgroup != None):
krista@4016
   318
                    matchphrase = mgroup.group(1)
krista@4016
   319
                    is_pointer = False
krista@4016
   320
                    while True:
krista@4016
   321
                        answer = input("ATTENTION: INPUT REQUIRED: In line " + line.lstrip() + ", is " + matchphrase + " a pointer? (y/n)")
krista@4016
   322
                        if (answer == "y" or answer == "Y"):
krista@4016
   323
                            is_pointer = True
krista@4016
   324
                            break
krista@4016
   325
                        elif (answer != "n" and answer != 'N'):
krista@4016
   326
                            print("\'" + answer + "\' is not a valid answer. Please answer with 'y' or 'n'.") 
krista@4016
   327
                            continue
krista@4016
   328
                        break;       
krista@4016
   329
                    
krista@4016
   330
                    if (is_pointer):
krista@4016
   331
                        modline = re.sub(r'TEST_ASSERT_MSG\((.*),.*\);',r'ASSERT_NE(\1, nullptr);', line)
krista@4016
   332
                        if (line != modline):
krista@4016
   333
                            newfile.write(modline + "\n")
krista@4016
   334
                            continue
krista@4016
   335
                        modline = re.sub(r'TEST_ASSERT\((.*)\);', r'ASSERT_NE(\1, nullptr);',line)
krista@4016
   336
                        if (line != modline):
krista@4016
   337
                            newfile.write(modline + "\n")
krista@4016
   338
                            continue
krista@4016
   339
                    else:        
krista@4016
   340
                        modline = re.sub(r'TEST_ASSERT_MSG\((.*),.*\);',r'ASSERT_TRUE(\1);', line)
krista@4016
   341
                        if (line != modline):
krista@4016
   342
                            newfile.write(modline + "\n")
krista@4016
   343
                            continue
krista@4016
   344
                        modline = re.sub(r'TEST_ASSERT\((.*)\);', r'ASSERT_TRUE(\1);',line)
krista@4016
   345
                        if (line != modline):
krista@4016
   346
                            newfile.write(modline + "\n")
krista@4016
   347
                            continue
krista@4016
   348
                
krista@4016
   349
                #Ok, it's something else. Print line and go.
krista@4016
   350
                newfile.write(line + "\n")