vyperlang / vyper

Pythonic Smart Contract Language for the EVM
https://vyperlang.org
Other
4.91k stars 803 forks source link

fix[tool]: fix output formats for .vyz files #4338

Open charles-cooper opened 1 month ago

charles-cooper commented 1 month ago

run the format name through the translate map. for instance, -f annotated_ast was not working for .vyz files.

What I did

How I did it

How to verify it

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

![Put a link to a cute animal picture inside the parenthesis-->]()

cyberthirst commented 4 weeks ago

let's add this

def test_archive_compile_options(input_files):
    tmpdir, _, _, contract_file = input_files
    search_paths = [".", tmpdir]

    options = ["abi_python", "json", "ast", "annotated_ast", "ir_json"]

    for option in options:
        out = compile_files([contract_file], ["archive_b64", option], paths=search_paths)

        archive_b64 = out[contract_file].pop("archive_b64")

        archive_path = Path("foo.zip.b64")
        with archive_path.open("w") as f:
            f.write(archive_b64)

        # compare compiling the two input bundles
        out2 = compile_files([archive_path], [option])

        if option in ["ast", "annotated_ast"]:
            # would have to normalize paths and imports, so just verify it compiles
            continue

        assert out[contract_file] == out2[archive_path]