def test_lex_stdlib(): path = find_pony_stdlib_path() for root, dirs, files in os.walk(path): for ponysrc in [f for f in files if f.endswith(".pony")]: with open(os.path.join(root, ponysrc)) as src: print(os.path.join(root, ponysrc)) [t for t in lex_raw(src)]
def test_parse_stdlib(): path = find_pony_stdlib_path() for root, _, files in os.walk(path): for ponysrc in [f for f in files if f.endswith(".pony")]: fname = os.path.join(root, ponysrc) if PONY_FILE is None or fname == PONY_FILE: with open(fname) as src: print(fname) data = src.read() parse_code(data)
def test_program(): prg = Program(project_root=os.path.join(HERE, "test_program")) collections = prg.resolve_package("collections") assert collections.path == os.path.join(find_pony_stdlib_path(), "collections") collections2 = prg.resolve_package("collections") assert collections2 is collections package_one = prg.resolve_package("package_one") assert package_one.path == os.path.join(HERE, "test_program", "package_one")
def __init__(self, project_root=".", ponypath=None, stdlibpath=None): self.project_root = project_root stdlibpath = stdlibpath if stdlibpath else find_pony_stdlib_path() ponypath = ponypath if ponypath is not None else [project_root] self.ponypath = [stdlibpath] + ponypath self.pkgs = {}
def __init__(self, project_root=".", stdlibpath=None): self.project_root = project_root stdlibpath = stdlibpath if stdlibpath else find_pony_stdlib_path() self.ponypath = [stdlibpath] + _get_ponypath()