예제 #1
0
def main():
    """Main processing function.
    """
    files = []
    totfiles = 0
    testfile = "test.txt"
    sharpfile = "test-csharp.txt"

    # initialization
    libastyle.set_text_color("yellow")
    os.chdir(libastyle.get_file_py_directory())
    if not os.path.exists(testfile):
        libastyle.system_exit("Run regression2-test.py to create " + testfile)
    print(libastyle.get_python_version())
    print("extracting C# test data")

    # process formatted files
    files = libtest.get_formatted_files(testfile)
    outfile = open(sharpfile, 'w')
    for filepath in files:
        filepath = filepath.replace('\\', '/')  # replace file separators
        filepath = '\"' + filepath + '\",'  # add quotes to filepath
        outfile.write(filepath + '\n')
        totfiles += 1
    outfile.close()
    print("saved " + sharpfile)
    print("files extracted " + str(totfiles))
    formatted, unused, unused, unused = libtest.get_astyle_totals(testfile)
    if totfiles != formatted:
        libastyle.system_exit("totals not equal {0} {1}".format(
            totfiles, formatted))
예제 #2
0
def main():
    """Main processing function.
    """
    files = []
    totfiles = 0
    testfile = "test.txt"
    sharpfile = "test-csharp.txt"

    # initialization
    libastyle.set_text_color()
    os.chdir(libastyle.get_file_py_directory())
    if not os.path.exists(testfile):
        libastyle.system_exit(
            "Run regression2-test.py to create " + testfile)
    print(libastyle.get_python_version())
    print("extracting C# test data")

    # process formatted files
    files = libtest.get_formatted_files(testfile)
    outfile = open(sharpfile, 'w')
    for filepath in files:
        filepath = filepath.replace('\\', '/')  # replace file separators
        filepath = '\"' + filepath + '\",'      # add quotes to filepath
        outfile.write(filepath + '\n')
        totfiles += 1
    outfile.close()
    print ("saved " + sharpfile)
    print("files extracted " + str(totfiles))
    formatted, unused, unused, unused = libtest.get_astyle_totals(testfile)
    if totfiles != formatted:
        libastyle.system_exit(
            "totals not equal {0} {1}".format(totfiles, formatted))
예제 #3
0
def process_diffs():
    """Main processing function.
	"""
    libastyle.set_text_color()
    os.chdir(libastyle.get_file_py_directory())
    testfile = "test.txt"
    formatted, unchanged, min, sec = libtest.get_astyle_totals(testfile)
    files = libtest.get_formatted_files(testfile)
    verify_formatted_files(len(files), formatted)
    libtest.diff_formatted_files(files)
예제 #4
0
def main():
	"""Main processing function.
	"""
	libastyle.set_text_color()
	print(libastyle.get_python_version())
	os.chdir(libastyle.get_file_py_directory())
	testfile = "test.txt"
	formatted, unused, unused, unused = libtest.get_astyle_totals(testfile)
	files = libtest.get_formatted_files(testfile)
	verify_formatted_files(len(files), formatted)
	libtest.diff_formatted_files(files)
예제 #5
0
def print_astyle_totals(filename):
    """Print total information from the astyle total line.
       Returns files formatted and total files from the report total line.
    """
    formatted, totfiles, minute, sec = libtest.get_astyle_totals(filename)
    if min == 0:
        printline = "{0:n} formatted; {1:n} files; {2} seconds"
        print(printline.format(formatted, totfiles, sec))
    else:
        printline = "{0:n} formatted; {1:n} files; {2} min {3} seconds"
        print(printline.format(formatted, totfiles, minute, sec))
    return formatted, totfiles
예제 #6
0
def print_astyle_totals(filename):
    """Print total information from the astyle total line.
	   Returns files formatted and total files from the report total line.
	"""
    formatted, totfiles, minute, sec = libtest.get_astyle_totals(filename)
    if min == 0:
        printline = "{0:n} formatted; {1:n} files; {2} seconds"
        print(printline.format(formatted, totfiles, sec))
    else:
        printline = "{0:n} formatted; {1:n} files; {2} min {3} seconds"
        print(printline.format(formatted, totfiles, minute, sec))
    return (formatted, totfiles)
예제 #7
0
def print_astyle_totals(filename):
    """Print total information from the astyle total line.
	   Returns files formatted and total files from the report total line.
	"""
    # the native locale should be set to get the numeric formatting
    formatted, totfiles, min, sec = libtest.get_astyle_totals(filename)
    if min == 0:
        printline = "{0:n} formatted; {1:n} files; {2} seconds"
        print printline.format(formatted, totfiles, sec)
    else:
        printline = "{0:n} formatted; {1:n} files; {2} min {3} seconds"
        print printline.format(formatted, totfiles, min, sec)
    return (formatted, totfiles)
예제 #8
0
def print_astyle_totals(filename):
    """Print total information from the astyle total line.
       Returns files formatted and total files from the report total line.
    """
    # the native locale should be set to get the numeric formatting
    formatted, totfiles, minute, sec = libtest.get_astyle_totals(filename)
    if minute == 0:
        printline = "{0:n} formatted; {1:n} files; {2} seconds"
        print(printline.format(formatted, totfiles, sec))
    else:
        printline = "{0:n} formatted; {1:n} files; {2} min {3} seconds"
        print(printline.format(formatted, totfiles, minute, sec))
    return (formatted, totfiles)