File tree Expand file tree Collapse file tree 11 files changed +157
-8
lines changed
crates/wit-component/tests
missing-features/component-model
missing-features/component-model Expand file tree Collapse file tree 11 files changed +157
-8
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use libtest_mimic::{Arguments, Trial};
33use pretty_assertions:: assert_eq;
44use std:: fs;
55use std:: path:: Path ;
6+ use wasmparser:: WasmFeatures ;
67use wit_component:: WitPrinter ;
78use wit_parser:: { PackageId , Resolve , UnresolvedPackageGroup } ;
89
@@ -61,7 +62,7 @@ fn run_test(path: &Path, is_dir: bool) -> Result<()> {
6162 let wasm = wit_component:: encode ( & resolve, package) ?;
6263 let wat = wasmprinter:: print_bytes ( & wasm) ?;
6364 assert_output ( & path. with_extension ( "wat" ) , & wat) ?;
64- wasmparser:: Validator :: new ( )
65+ wasmparser:: Validator :: new_with_features ( WasmFeatures :: all ( ) )
6566 . validate_all ( & wasm)
6667 . context ( "failed to validate wasm output" ) ?;
6768
Original file line number Diff line number Diff line change 33(component
44 (core module $m
55 (memory (export " memory" ) 1 )
6- (func (export " ret-map" ) (result i32 i32 ) unreachable )
6+ (func (export " ret-map" ) (result i32 ) unreachable )
77 )
88 (core instance $i (instantiate $m ))
99
1414
1515(component
1616 (core module $m
17+ (memory (export " memory" ) 1 )
1718 (func (export " param-map" ) (param i32 i32 ) unreachable )
19+ (func (export " realloc" ) (param i32 i32 i32 i32 ) (result i32 ) unreachable )
1820 )
1921 (core instance $i (instantiate $m ))
2022
2123 (func (export " param-map" ) (param " m" (map string u32))
22- (canon lift (core func $i " param-map" ))
24+ (canon lift (core func $i " param-map" ) ( memory $i " memory " ) (realloc ( func $i " realloc " )) )
2325 )
2426)
2527
2628(component
2729 (type $map-type (map u32 string))
28- (func ( export " f" ) ( param " x" $map-type ))
30+ (import " f" ( func ( param " x" $map-type ) ))
2931)
3032
3133(component
3234 (type $nested-map (map string (map string u32)))
33- (func ( export " f" ) ( param " x" $nested-map ))
35+ (import " f" ( func ( param " x" $nested-map ) ))
3436)
3537
3638(component
3739 (type $map-with-list (map string (list u32)))
38- (func ( export " f" ) ( param " x" $map-with-list ))
40+ (import " f" ( func ( param " x" $map-with-list ) ))
3941)
4042
4143(component
4244 (type $map-with-option (map u32 (option string)))
43- (func ( export " f" ) ( param " x" $map-with-option ))
45+ (import " f" ( func ( param " x" $map-with-option ) ))
4446)
4547
4648(assert_invalid
Original file line number Diff line number Diff line change 3232(assert_invalid
3333 (component
3434 (type $map-type (map u32 string))
35- (func ( export " f" ) ( param " x" $map-type ))
35+ (import " f" ( func ( param " x" $map-type ) ))
3636 )
3737 " Maps require the component model map feature"
3838)
Original file line number Diff line number Diff line change 1+ {
2+ "source_filename" : " tests/cli/component-model/map.wast" ,
3+ "commands" : [
4+ {
5+ "type" : " module" ,
6+ "line" : 3 ,
7+ "filename" : " map.0.wasm" ,
8+ "module_type" : " binary"
9+ },
10+ {
11+ "type" : " module" ,
12+ "line" : 15 ,
13+ "filename" : " map.1.wasm" ,
14+ "module_type" : " binary"
15+ },
16+ {
17+ "type" : " module" ,
18+ "line" : 28 ,
19+ "filename" : " map.2.wasm" ,
20+ "module_type" : " binary"
21+ },
22+ {
23+ "type" : " module" ,
24+ "line" : 33 ,
25+ "filename" : " map.3.wasm" ,
26+ "module_type" : " binary"
27+ },
28+ {
29+ "type" : " module" ,
30+ "line" : 38 ,
31+ "filename" : " map.4.wasm" ,
32+ "module_type" : " binary"
33+ },
34+ {
35+ "type" : " module" ,
36+ "line" : 43 ,
37+ "filename" : " map.5.wasm" ,
38+ "module_type" : " binary"
39+ },
40+ {
41+ "type" : " assert_invalid" ,
42+ "line" : 49 ,
43+ "filename" : " map.6.wasm" ,
44+ "module_type" : " binary" ,
45+ "text" : " type mismatch for import `x`"
46+ },
47+ {
48+ "type" : " assert_invalid" ,
49+ "line" : 61 ,
50+ "filename" : " map.7.wasm" ,
51+ "module_type" : " binary" ,
52+ "text" : " type mismatch for import `x`"
53+ }
54+ ]
55+ }
Original file line number Diff line number Diff line change 1+ (component
2+ (core module $m (;0;)
3+ (type (;0;) (func (result i32)))
4+ (memory (;0;) 1)
5+ (export "memory" (memory 0))
6+ (export "ret-map" (func 0))
7+ (func (;0;) (type 0) (result i32)
8+ unreachable
9+ )
10+ )
11+ (core instance $i (;0;) (instantiate $m))
12+ (type (;0;) (map string u32))
13+ (type (;1;) (func (result 0)))
14+ (alias core export $i "ret-map" (core func (;0;)))
15+ (alias core export $i "memory" (core memory (;0;)))
16+ (func (;0;) (type 1) (canon lift (core func 0) (memory 0)))
17+ (export (;1;) "ret-map" (func 0))
18+ )
Original file line number Diff line number Diff line change 1+ (component
2+ (core module $m (;0;)
3+ (type (;0;) (func (param i32 i32)))
4+ (type (;1;) (func (param i32 i32 i32 i32) (result i32)))
5+ (memory (;0;) 1)
6+ (export "memory" (memory 0))
7+ (export "param-map" (func 0))
8+ (export "realloc" (func 1))
9+ (func (;0;) (type 0) (param i32 i32)
10+ unreachable
11+ )
12+ (func (;1;) (type 1) (param i32 i32 i32 i32) (result i32)
13+ unreachable
14+ )
15+ )
16+ (core instance $i (;0;) (instantiate $m))
17+ (type (;0;) (map string u32))
18+ (type (;1;) (func (param "m" 0)))
19+ (alias core export $i "param-map" (core func (;0;)))
20+ (alias core export $i "memory" (core memory (;0;)))
21+ (alias core export $i "realloc" (core func (;1;)))
22+ (func (;0;) (type 1) (canon lift (core func 0) (memory 0) (realloc 1)))
23+ (export (;1;) "param-map" (func 0))
24+ )
Original file line number Diff line number Diff line change 1+ (component
2+ (type $map-type (;0;) (map u32 string))
3+ (type (;1;) (func (param "x" $map-type)))
4+ (import "f" (func (;0;) (type 1)))
5+ )
Original file line number Diff line number Diff line change 1+ (component
2+ (type (;0;) (map string u32))
3+ (type $nested-map (;1;) (map string 0))
4+ (type (;2;) (func (param "x" $nested-map)))
5+ (import "f" (func (;0;) (type 2)))
6+ )
Original file line number Diff line number Diff line change 1+ (component
2+ (type (;0;) (list u32))
3+ (type $map-with-list (;1;) (map string 0))
4+ (type (;2;) (func (param "x" $map-with-list)))
5+ (import "f" (func (;0;) (type 2)))
6+ )
Original file line number Diff line number Diff line change 1+ (component
2+ (type (;0;) (option string))
3+ (type $map-with-option (;1;) (map u32 0))
4+ (type (;2;) (func (param "x" $map-with-option)))
5+ (import "f" (func (;0;) (type 2)))
6+ )
You can’t perform that action at this time.
0 commit comments