()
| 862 | |
| 863 | #[test] |
| 864 | fn introspection() -> Result<()> { |
| 865 | let engine = super::engine(); |
| 866 | |
| 867 | let component = Component::new( |
| 868 | &engine, |
| 869 | format!( |
| 870 | r#" |
| 871 | (component |
| 872 | (import "res" (type $res (sub resource))) |
| 873 | |
| 874 | (import "ai" (instance $i)) |
| 875 | (import "bi" (instance $i2 (export "m" (core module)))) |
| 876 | |
| 877 | (alias export $i2 "m" (core module $m)) |
| 878 | |
| 879 | (type $t (func (param "a" u32) (result u32))) |
| 880 | (component $a |
| 881 | (core module $m |
| 882 | (func (export "add-five") (param i32) (result i32) |
| 883 | local.get 0 |
| 884 | i32.const 5 |
| 885 | i32.add) |
| 886 | ) |
| 887 | (core instance $m (instantiate $m)) |
| 888 | (func (export "add-five") (type $t) (canon lift (core func $m "add-five"))) |
| 889 | ) |
| 890 | (component $b |
| 891 | (import "interface-v1" (instance $i |
| 892 | (export "add-five" (func (type $t))))) |
| 893 | (core module $m |
| 894 | (func $add-five (import "interface-0.1.0" "add-five") (param i32) (result i32)) |
| 895 | (func) ;; causes index out of bounds |
| 896 | (func (export "run") (result i32) i32.const 0 call $add-five) |
| 897 | ) |
| 898 | (core func $add-five (canon lower (func $i "add-five"))) |
| 899 | (core instance $i (instantiate 0 |
| 900 | (with "interface-0.1.0" (instance |
| 901 | (export "add-five" (func $add-five)) |
| 902 | )) |
| 903 | )) |
| 904 | (func (result u32) (canon lift (core func $i "run"))) |
| 905 | (export "run" (func 1)) |
| 906 | ) |
| 907 | (instance $a (instantiate $a)) |
| 908 | (instance $b (instantiate $b (with "interface-v1" (instance $a)))) |
| 909 | (export "run" (func $b "run")) |
| 910 | |
| 911 | (component $c |
| 912 | (component $c |
| 913 | (export "m" (core module $m)) |
| 914 | ) |
| 915 | (instance $c (instantiate $c)) |
| 916 | (export "i" (instance $c)) |
| 917 | ) |
| 918 | (instance $c (instantiate $c)) |
| 919 | (export "i" (instance $c)) |
| 920 | (export "r" (instance $i)) |
| 921 | (export "r2" (instance $i2)) |
nothing calls this directly
no test coverage detected