Skip to content

Commit 6d6c315

Browse files
authored
Switch lists runtime test to use default ownership strategy (#771)
Signed-off-by: Ryan Levick <[email protected]>
1 parent 1af7e87 commit 6d6c315

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

tests/runtime/lists.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ use wasmtime::Store;
33

44
wasmtime::component::bindgen!({
55
path: "tests/runtime/lists",
6-
ownership: Borrowing {
7-
duplicate_if_necessary: true
8-
}
96
});
107

118
#[derive(Default)]
@@ -127,8 +124,17 @@ fn run_test(lists: Lists, store: &mut Store<crate::Wasi<MyImports>>) -> Result<(
127124
assert_eq!(exports.call_empty_string_result(&mut *store)?, "");
128125
exports.call_list_param(&mut *store, &[1, 2, 3, 4])?;
129126
exports.call_list_param2(&mut *store, "foo")?;
130-
exports.call_list_param3(&mut *store, &["foo", "bar", "baz"])?;
131-
exports.call_list_param4(&mut *store, &[&["foo", "bar"], &["baz"]])?;
127+
exports.call_list_param3(
128+
&mut *store,
129+
&["foo".to_owned(), "bar".to_owned(), "baz".to_owned()],
130+
)?;
131+
exports.call_list_param4(
132+
&mut *store,
133+
&[
134+
vec!["foo".to_owned(), "bar".to_owned()],
135+
vec!["baz".to_owned()],
136+
],
137+
)?;
132138
assert_eq!(exports.call_list_result(&mut *store)?, [1, 2, 3, 4, 5]);
133139
assert_eq!(exports.call_list_result2(&mut *store)?, "hello!");
134140
assert_eq!(

tests/runtime/lists/wasm.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ wit_bindgen::generate!({
44
world: Component,
55
"test:lists/test": Component
66
},
7-
ownership: Borrowing {
8-
duplicate_if_necessary: false
9-
}
107
});
118

129
struct Component;
@@ -28,8 +25,11 @@ impl Guest for Component {
2825

2926
list_param(&[1, 2, 3, 4]);
3027
list_param2("foo");
31-
list_param3(&["foo", "bar", "baz"]);
32-
list_param4(&[&["foo", "bar"], &["baz"]]);
28+
list_param3(&["foo".to_owned(), "bar".to_owned(), "baz".to_owned()]);
29+
list_param4(&[
30+
vec!["foo".to_owned(), "bar".to_owned()],
31+
vec!["baz".to_owned()],
32+
]);
3333
assert_eq!(list_result(), [1, 2, 3, 4, 5]);
3434
assert_eq!(list_result2(), "hello!");
3535
assert_eq!(list_result3(), ["hello,", "world!"]);

0 commit comments

Comments
 (0)