1+ use std:: collections:: BTreeMap ;
2+
13use expect_test:: expect_file;
24use miden_core:: crypto:: hash:: RpoDigest ;
35use miden_frontend_wasm:: { ExportMetadata , ImportMetadata , WasmTranslationConfig } ;
4- use miden_hir:: { InterfaceFunctionIdent , InterfaceIdent , Symbol } ;
6+ use miden_hir:: { FunctionExportName , InterfaceFunctionIdent , InterfaceIdent , Symbol } ;
57
68use crate :: CompilerTest ;
79
@@ -27,7 +29,7 @@ fn sdk_basic_wallet() {
2729 interface : interface. clone ( ) ,
2830 function : Symbol :: intern ( "remove-asset" ) ,
2931 } ;
30- let import_metadata = [
32+ let import_metadata: BTreeMap < InterfaceFunctionIdent , ImportMetadata > = [
3133 (
3234 create_note_ident. clone ( ) ,
3335 ImportMetadata {
@@ -52,7 +54,7 @@ fn sdk_basic_wallet() {
5254 ]
5355 . into_iter ( )
5456 . collect ( ) ;
55- let export_metadata = [
57+ let export_metadata: BTreeMap < FunctionExportName , ExportMetadata > = [
5658 (
5759 Symbol :: intern ( "send-asset" ) . into ( ) ,
5860 ExportMetadata {
@@ -69,14 +71,21 @@ fn sdk_basic_wallet() {
6971 . into_iter ( )
7072 . collect ( ) ;
7173 let config = WasmTranslationConfig {
72- import_metadata,
73- export_metadata,
74+ import_metadata : import_metadata . clone ( ) ,
75+ export_metadata : export_metadata . clone ( ) ,
7476 ..Default :: default ( )
7577 } ;
7678 let mut test = CompilerTest :: rust_source_cargo_component ( "sdk/basic-wallet" , config) ;
7779 let artifact_name = test. source . artifact_name ( ) ;
7880 test. expect_wasm ( expect_file ! [ format!( "../../expected/sdk_basic_wallet/{artifact_name}.wat" ) ] ) ;
7981 test. expect_ir ( expect_file ! [ format!( "../../expected/sdk_basic_wallet/{artifact_name}.hir" ) ] ) ;
82+ let ir = test. hir ( ) . unwrap_component ( ) ;
83+ for ( _, import) in ir. imports ( ) {
84+ assert ! ( import_metadata. contains_key( & import. interface_function) ) ;
85+ }
86+ for ( name, _meta) in export_metadata {
87+ assert ! ( ir. exports( ) . contains_key( & name) ) ;
88+ }
8089}
8190
8291#[ test]
0 commit comments