| 3444 | |
| 3445 | #[test] |
| 3446 | fn wizer_components() -> Result<()> { |
| 3447 | let result = wizen( |
| 3448 | &[], |
| 3449 | r#" |
| 3450 | (component |
| 3451 | (core module $a |
| 3452 | (global (mut i32) (i32.const 0)) |
| 3453 | (func (export "init") |
| 3454 | i32.const 100 |
| 3455 | global.set 0) |
| 3456 | ) |
| 3457 | (core instance $a (instantiate $a)) |
| 3458 | (func (export "wizer-initialize") (canon lift (core func $a "init"))) |
| 3459 | ) |
| 3460 | "#, |
| 3461 | )?; |
| 3462 | assert!(result.status.success()); |
| 3463 | |
| 3464 | let component_with_wasi = r#" |
| 3465 | (component |
| 3466 | (import "wasi:cli/environment@0.2.0" (instance |
| 3467 | (export "get-arguments" (func (result (list string)))) |
| 3468 | )) |
| 3469 | (core module $a |
| 3470 | (global (mut i32) (i32.const 0)) |
| 3471 | (func (export "init") |
| 3472 | i32.const 100 |
| 3473 | global.set 0) |
| 3474 | ) |
| 3475 | (core instance $a (instantiate $a)) |
| 3476 | (func (export "wizer-initialize") (canon lift (core func $a "init"))) |
| 3477 | ) |
| 3478 | "#; |
| 3479 | |
| 3480 | let result = wizen(&[], component_with_wasi)?; |
| 3481 | assert!(!result.status.success()); |
| 3482 | let result = wizen(&["-Scli"], component_with_wasi)?; |
| 3483 | assert!(result.status.success()); |
| 3484 | |
| 3485 | Ok(()) |
| 3486 | } |
| 3487 | |
| 3488 | #[test] |
| 3489 | #[cfg_attr(not(target_os = "linux"), ignore)] |