summaryrefslogtreecommitdiffstats
path: root/vendor/wasm-bindgen/tests/wasm/slice.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /vendor/wasm-bindgen/tests/wasm/slice.rs
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/wasm-bindgen/tests/wasm/slice.rs')
-rw-r--r--vendor/wasm-bindgen/tests/wasm/slice.rs32
1 files changed, 21 insertions, 11 deletions
diff --git a/vendor/wasm-bindgen/tests/wasm/slice.rs b/vendor/wasm-bindgen/tests/wasm/slice.rs
index 6e659ce6f..9f9066fe7 100644
--- a/vendor/wasm-bindgen/tests/wasm/slice.rs
+++ b/vendor/wasm-bindgen/tests/wasm/slice.rs
@@ -22,7 +22,7 @@ extern "C" {
}
macro_rules! export_macro {
- ($(($i:ident, $n:ident))*) => ($(
+ ($(($i:ident, $n:ident, $optional_n:ident))*) => ($(
#[wasm_bindgen]
pub fn $n(a: &[$i]) -> Vec<$i> {
assert_eq!(a.len(), 2);
@@ -30,20 +30,30 @@ macro_rules! export_macro {
assert_eq!(a[1], 2 as $i);
a.to_vec()
}
+
+ #[wasm_bindgen]
+ pub fn $optional_n(a: Option<Vec<$i>>) -> Option<Vec<$i>> {
+ a.map(|a| {
+ assert_eq!(a.len(), 2);
+ assert_eq!(a[0], 1 as $i);
+ assert_eq!(a[1], 2 as $i);
+ a.to_vec()
+ })
+ }
)*)
}
export_macro! {
- (i8, export_i8)
- (u8, export_u8)
- (i16, export_i16)
- (u16, export_u16)
- (i32, export_i32)
- (u32, export_u32)
- (isize, export_isize)
- (usize, export_usize)
- (f32, export_f32)
- (f64, export_f64)
+ (i8, export_i8, export_optional_i8)
+ (u8, export_u8, export_optional_u8)
+ (i16, export_i16, export_optional_i16)
+ (u16, export_u16, export_optional_u16)
+ (i32, export_i32, export_optional_i32)
+ (u32, export_u32, export_optional_u32)
+ (isize, export_isize, export_optional_isize)
+ (usize, export_usize, export_optional_usize)
+ (f32, export_f32, export_optional_f32)
+ (f64, export_f64, export_optional_f64)
}
#[wasm_bindgen_test]