Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasmprinter] support custom indent text #1963

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

oovm
Copy link

@oovm oovm commented Dec 23, 2024

Close #1962

crates/wasmprinter/tests/all.rs Outdated Show resolved Hide resolved
src/bin/wasm-tools/print.rs Show resolved Hide resolved
@oovm
Copy link
Author

oovm commented Dec 27, 2024

It seems that '\t' is not supported, so I agree to use --indent

;; RUN: print --indent-text '\t' %

---- "tests/cli\\print-custom-indent-text.wat" ----
failed test "tests/cli\\print-custom-indent-text.wat"

Caused by:
    0: failed RUN directive `` on line 1
    1: failed to check stdout expectation (auto-update with BLESS=1)
    2: failed test: result is not as expected:Diff < left / right > :
        (module
       <        (type (;0;) (func (param i32) (result i32)))
       <        (func (;0;) (type 0) (param i32) (result i32)
       <                local.get 0
       <        )
       <        (export "f" (func 0))
       >'/t'(type (;0;) (func (param i32) (result i32)))
       >'/t'(export "f" (func 0))
       >'/t'(func (;0;) (type 0) (param i32) (result i32)
       >'/t''/t'local.get 0
       >'/t')
        )

failures:
    "tests/cli\\print-custom-indent-text.wat"

test result: FAILED. 125 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 10.92s


Very strange, spaces are not supported either.

;; RUN: print --indent-text "    " %

---- "tests/cli\\print-custom-indent-text.wat" ----
failed test "tests/cli\\print-custom-indent-text.wat"

Caused by:
    0: failed RUN directive `` on line 1
    1: "E:\\RustroverProjects\\wasm-tools\\target\\debug\\wasm-tools.exe" "print" "--indent-text" "\"" "\"" "tests/cli\\print-custom-indent-text.wat" failed:
                    status: exit code: 2
                    stdout:
                    stderr: error: unexpected argument 'tests/cli\print-custom-indent-text.wat' found

@oovm
Copy link
Author

oovm commented Dec 27, 2024

It seems that run_test has some problems, and does not support strings and escapes, whether it is \t, '\t' or " "

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wasmprinter: make indent character configurable
2 participants