@@ -25,6 +25,7 @@ async function run() {
25
25
} ,
26
26
listResult2 ( ) { return 'hello!' ; } ,
27
27
listResult3 ( ) { return [ 'hello,' , 'world!' ] ; } ,
28
+ listRoundtrip ( x ) { return x ; } ,
28
29
stringRoundtrip ( x ) { return x ; } ,
29
30
30
31
unalignedRoundtrip1 ( u16 , u32 , u64 , flag32 , flag64 ) {
@@ -119,6 +120,12 @@ async function run() {
119
120
assert . deepStrictEqual ( Array . from ( wasm . listResult ( ) ) , [ 1 , 2 , 3 , 4 , 5 ] ) ;
120
121
assert . deepStrictEqual ( wasm . listResult2 ( ) , "hello!" ) ;
121
122
assert . deepStrictEqual ( wasm . listResult3 ( ) , [ "hello," , "world!" ] ) ;
123
+
124
+ const buffer = new ArrayBuffer ( 8 ) ;
125
+ ( new Uint8Array ( buffer ) ) . set ( new Uint8Array ( [ 1 , 2 , 3 , 4 ] ) , 2 ) ;
126
+ // Create a view of the four bytes in the middle of the buffer
127
+ const view = new Uint8Array ( buffer , 2 , 4 ) ;
128
+ assert . deepStrictEqual ( Array . from ( wasm . listRoundtrip ( view ) ) , [ 1 , 2 , 3 , 4 ] ) ;
122
129
123
130
assert . deepStrictEqual ( wasm . stringRoundtrip ( "x" ) , "x" ) ;
124
131
assert . deepStrictEqual ( wasm . stringRoundtrip ( "" ) , "" ) ;
0 commit comments