| ... | ... | @@ -12,6 +12,11 @@ const linux_riscv64 = std.zig.CrossTarget{ |
| 12 | 12 | .os_tag = .linux, |
| 13 | 13 | }; |
| 14 | 14 | |
| 15 | const wasi = std.zig.CrossTarget{ |
| 16 | .cpu_arch = .wasm32, |
| 17 | .os_tag = .wasi, |
| 18 | }; |
| 19 | |
| 15 | 20 | pub fn addCases(ctx: *TestContext) !void { |
| 16 | 21 | { |
| 17 | 22 | var case = ctx.exe("hello world with updates", linux_x64); |
| ... | ... | @@ -539,4 +544,35 @@ pub fn addCases(ctx: *TestContext) !void { |
| 539 | 544 | "", |
| 540 | 545 | ); |
| 541 | 546 | } |
| 547 | |
| 548 | { |
| 549 | var case = ctx.exe("wasm returns", wasi); |
| 550 | |
| 551 | case.addCompareOutput( |
| 552 | \\export fn _start() u32 { |
| 553 | \\ return 42; |
| 554 | \\} |
| 555 | , |
| 556 | "42\n", |
| 557 | ); |
| 558 | |
| 559 | case.addCompareOutput( |
| 560 | \\export fn _start() i64 { |
| 561 | \\ return 42; |
| 562 | \\} |
| 563 | , |
| 564 | "42\n", |
| 565 | ); |
| 566 | |
| 567 | case.addCompareOutput( |
| 568 | \\export fn _start() f32 { |
| 569 | \\ return 42.0; |
| 570 | \\} |
| 571 | , |
| 572 | // This is what you get when you take the bits of the IEE-754 |
| 573 | // representation of 42.0 and reinterpret them as an unsigned |
| 574 | // integer. Guess that's a bug in wasmtime. |
| 575 | "1109917696\n", |
| 576 | ); |
| 577 | } |
| 542 | 578 | } |