Exemplo n.º 1
0
def parse(path, depth):
    sys.stdout = StringIO()
    logging.config.fileConfig(logging_setting_path)
    logger = logging.getLogger(__file__)
    target_file_path = path
    ast_info = AstProcessor(logging,
                            BasicInfoListener()).execute(target_file_path)
    sys.stdout = sys.__stdout__
    #print(ast_info)
    print("   " * depth, blue(ast_info["className"]))
    for method in ast_info["methods"]:
        print("   " * depth, yellow(method["methodName"]))
Exemplo n.º 2
0
def parse(path, depth):
    sys.stdout = StringIO()
    logging.config.fileConfig(logging_setting_path)
    logger = logging.getLogger(__file__)
    target_file_path = path
    ast_info = AstProcessor(logging,
                            BasicInfoListener()).execute(target_file_path)
    sys.stdout = sys.__stdout__
    #print(ast_info)
    print("   " * depth, blue(ast_info["className"]))
    for method in ast_info["methods"]:
        print("   " * depth, yellow(method["methodName"]))

    text = open(path, "r")
    text = [i.strip() for i in text]
    #print(text)
    assertText = [i for i in text if i[:6] == "assert"]
    for i in assertText:
        print(i)
Exemplo n.º 3
0
import logging.config
from ast.ast_processor import AstProcessor
from ast.basic_info_listener import BasicInfoListener

if __name__ == '__main__':
    # target_file_path = 'C:/pbl/home/junit/src/test/java/jp/enpit/cloud/junit/CalculatorTest.java'
    target_file_path = 'C:/Users/ryosuke-ku/Desktop/NiCad-5.1/systems/maven/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java'
    # target_file_path = 'C:/Users/ryosuke-ku/Desktop/NiCad-5.1/systems/maven/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/StringSearchModelInterpolator.java'

    # ★ポイント1
    ast_info = AstProcessor(None,
                            BasicInfoListener()).execute(target_file_path)