示例#1
0
def get_batch_directory():
	"""Get the AStyle/src directory for the os environment"""
	home_directory = libastyle.get_home_directory()
	if os.name == "nt":
		return home_directory + "/batch"
	else:
		return home_directory + "/bin"
示例#2
0
def test_file_write(filename):
    """Write a file for testing this module.
	"""
    outfile = open(filename, 'w')
    text = ("Artistic Style 1.xx\n"
            "--------------------------------------------------\n"
            "directory $HOME/Projects/TestData/Project/*.cpp\n"
            "--------------------------------------------------\n"
            "formatted  plugins/astyle/astyle/ASFormatter.cpp\n"
            "unchanged* plugins/astyle/astyle/Unchanged.cpp\n"
            "formatted  plugins/codecompletion/parser.cpp\n"
            "unchanged* plugins/codecompletion/unchanged.cpp\n"
            "--------------------------------------------------\n"
            "2 formatted, 2 unchanged, 10 seconds, 1000 lines\n")
    text = text.replace("$HOME", libastyle.get_home_directory())
    outfile.write(text)
    outfile.close()
示例#3
0
文件: libtest.py 项目: a-w/astyle
def test_file_write(filename):
    """Write a file for testing this module.
    """
    outfile = open(filename, 'w')
    text = (
        "Artistic Style 1.xx\n"
        "--------------------------------------------------\n"
        "directory $HOME/Projects/TestData/Project/*.cpp\n"
        "--------------------------------------------------\n"
        "formatted  plugins/astyle/astyle/ASFormatter.cpp\n"
        "unchanged* plugins/astyle/astyle/Unchanged.cpp\n"
        "formatted  plugins/codecompletion/parser.cpp\n"
        "unchanged* plugins/codecompletion/unchanged.cpp\n"
        "--------------------------------------------------\n"
        "2 formatted, 2 unchanged, 10 seconds, 1000 lines\n"
    )
    text = text.replace("$HOME", libastyle.get_home_directory())
    outfile.write(text)
    outfile.close()
示例#4
0
import os
import shutil
import subprocess
import time

# global variables ------------------------------------------------------------

# Japanese codec - llisted in the documantation under "codecs (module)
if os.name == "nt":
    japanese = "cp932"
else:
    japanese = "utf_8"

# test directory
testpath = "/Projects/AStyleTest/ut-testcon"
testdir = libastyle.get_home_directory() + testpath

# subdirectories are the same as in AStyleTestI18n.cpp
# variables are converted to multi-byte Japanese
subdir1 = u"/アイウオ".encode(japanese)
subdir1a = u"/アイウオ/カキク".encode(japanese)
subdir1b = u"/アイウオ/ケコサ".encode(japanese)
subdir2 = u"/スセタチ".encode(japanese)

# formatting options
options = ""

# executable for test
astyleexe = "astyled"

# -----------------------------------------------------------------------------