()
| 558 | |
| 559 | #[tokio::test] |
| 560 | async fn rename_functions() -> Result<()> { |
| 561 | let wat = r#" |
| 562 | (module |
| 563 | (func (export "wizer-initialize")) |
| 564 | (func (export "func_a") (result i32) |
| 565 | i32.const 1) |
| 566 | (func (export "func_b") (result i32) |
| 567 | i32.const 2) |
| 568 | (func (export "func_c") (result i32) |
| 569 | i32.const 3)) |
| 570 | "#; |
| 571 | |
| 572 | let wasm = wat_to_wasm(wat)?; |
| 573 | let mut wizer = Wizer::new(); |
| 574 | wizer.func_rename("func_a", "func_b"); |
| 575 | wizer.func_rename("func_b", "func_c"); |
| 576 | let wasm = wizer.run(&mut store()?, &wasm, instantiate).await?; |
| 577 | let wat = wasmprinter::print_bytes(&wasm).to_wasmtime_result()?; |
| 578 | |
| 579 | let expected_wat = r#" |
| 580 | (module |
| 581 | (type (;0;) (func)) |
| 582 | (type (;1;) (func (result i32))) |
| 583 | (export "func_a" (func 2)) |
| 584 | (export "func_b" (func 3)) |
| 585 | (func (;0;) (type 0)) |
| 586 | (func (;1;) (type 1) (result i32) |
| 587 | i32.const 1 |
| 588 | ) |
| 589 | (func (;2;) (type 1) (result i32) |
| 590 | i32.const 2 |
| 591 | ) |
| 592 | (func (;3;) (type 1) (result i32) |
| 593 | i32.const 3 |
| 594 | ) |
| 595 | ) |
| 596 | "#; |
| 597 | |
| 598 | assert_eq!(wat.trim(), expected_wat.trim()); |
| 599 | Ok(()) |
| 600 | } |
| 601 | |
| 602 | #[tokio::test] |
| 603 | async fn wasi_reactor() -> wasmtime::Result<()> { |
nothing calls this directly
no test coverage detected