Skip to content

Commit 9ffd6f9

Browse files
committed
Update component fuzzing and dynamic tests to replace call_and_post_return with call
1 parent 96439b9 commit 9ffd6f9

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

crates/test-util/src/component_fuzz.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ pub fn rust_type(ty: &Type, name_counter: &mut u32, declarations: &mut TokenStre
12821282
};
12831283

12841284
declarations.extend(quote! {
1285-
#[derive(ComponentType, Lift, Lower, PartialEq, Debug, Copy, Clone, Arbitrary)]
1285+
#[derive(ComponentType, Lift, Lower, PartialEq, Eq, Hash, Debug, Copy, Clone, Arbitrary)]
12861286
#[component(enum)]
12871287
#[repr(#repr)]
12881288
enum #name {

tests/all/component_model/dynamic.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn maps() -> Result<()> {
153153
let input = Val::Map(input_map);
154154

155155
let mut output = [Val::Bool(false)];
156-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
156+
func.call(&mut store, &[input.clone()], &mut output)?;
157157

158158
// Maps should round-trip correctly
159159
match &output[0] {
@@ -187,7 +187,7 @@ fn maps() -> Result<()> {
187187
let err_map = vec![(Val::String("key".into()), Val::String("value".into()))];
188188
let err = Val::Map(err_map);
189189
let err = func2
190-
.call_and_post_return(&mut store2, &[err], &mut output)
190+
.call(&mut store2, &[err], &mut output)
191191
.unwrap_err();
192192
assert!(err.to_string().contains("type mismatch"), "{err}");
193193

@@ -199,14 +199,14 @@ fn maps() -> Result<()> {
199199
let err_map2 = vec![(Val::U32(1), Val::U32(42))];
200200
let err = Val::Map(err_map2);
201201
let err = func3
202-
.call_and_post_return(&mut store3, &[err], &mut output)
202+
.call(&mut store3, &[err], &mut output)
203203
.unwrap_err();
204204
assert!(err.to_string().contains("type mismatch"), "{err}");
205205

206206
// Test empty map
207207
let empty_map = vec![];
208208
let input = Val::Map(empty_map);
209-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
209+
func.call(&mut store, &[input.clone()], &mut output)?;
210210
match &output[0] {
211211
Val::Map(output_map) => assert_eq!(output_map.len(), 0),
212212
_ => panic!("expected map"),
@@ -238,7 +238,7 @@ fn maps_complex_types() -> Result<()> {
238238
let input = Val::Map(input_map);
239239

240240
let mut output = [Val::Bool(false)];
241-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
241+
func.call(&mut store, &[input.clone()], &mut output)?;
242242

243243
// Verify round-trip
244244
match &output[0] {
@@ -331,7 +331,7 @@ fn maps_duplicate_keys() -> Result<()> {
331331
let input = Val::Map(input_map);
332332

333333
let mut output = [Val::Bool(false)];
334-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
334+
func.call(&mut store, &[input.clone()], &mut output)?;
335335

336336
// Verify all entries are preserved (Vec doesn't deduplicate)
337337
match &output[0] {
@@ -359,7 +359,7 @@ fn maps_all_primitive_types() -> Result<()> {
359359
let input = Val::Map(input_map);
360360

361361
let mut output = [Val::Bool(false)];
362-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
362+
func.call(&mut store, &[input.clone()], &mut output)?;
363363
assert_eq!(input, output[0]);
364364

365365
// Test map<string, u32>
@@ -373,7 +373,7 @@ fn maps_all_primitive_types() -> Result<()> {
373373
];
374374
let input = Val::Map(input_map);
375375

376-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
376+
func.call(&mut store, &[input.clone()], &mut output)?;
377377
assert_eq!(input, output[0]);
378378

379379
Ok(())
@@ -398,7 +398,7 @@ fn maps_alignment() -> Result<()> {
398398
let input = Val::Map(input_map);
399399

400400
let mut output = [Val::Bool(false)];
401-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
401+
func.call(&mut store, &[input.clone()], &mut output)?;
402402
assert_eq!(input, output[0]);
403403

404404
// Test map<u32, u64> - key_size=4, value_align=8
@@ -410,7 +410,7 @@ fn maps_alignment() -> Result<()> {
410410
let input_map = vec![(Val::U32(1), Val::U64(1000)), (Val::U32(2), Val::U64(2000))];
411411
let input = Val::Map(input_map);
412412

413-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
413+
func.call(&mut store, &[input.clone()], &mut output)?;
414414
assert_eq!(input, output[0]);
415415

416416
// Test map<u8, u32> - key_size=1, value_align=4
@@ -422,7 +422,7 @@ fn maps_alignment() -> Result<()> {
422422
let input_map = vec![(Val::U8(10), Val::U32(100)), (Val::U8(20), Val::U32(200))];
423423
let input = Val::Map(input_map);
424424

425-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
425+
func.call(&mut store, &[input.clone()], &mut output)?;
426426
assert_eq!(input, output[0]);
427427

428428
// Test map<u16, u64> - key_size=2, value_align=8
@@ -437,7 +437,7 @@ fn maps_alignment() -> Result<()> {
437437
];
438438
let input = Val::Map(input_map);
439439

440-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
440+
func.call(&mut store, &[input.clone()], &mut output)?;
441441
assert_eq!(input, output[0]);
442442

443443
Ok(())
@@ -459,7 +459,7 @@ fn maps_large() -> Result<()> {
459459
let input = Val::Map(input_map);
460460

461461
let mut output = [Val::Bool(false)];
462-
func.call_and_post_return(&mut store, &[input.clone()], &mut output)?;
462+
func.call(&mut store, &[input.clone()], &mut output)?;
463463

464464
// Verify all entries are present
465465
match &output[0] {

tests/all/component_model/func.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,7 +3863,7 @@ fn map_trampoline_alignment() -> Result<()> {
38633863
let input = Val::Map(test_data.clone());
38643864

38653865
let mut results = [Val::Bool(false)];
3866-
func.call_and_post_return(&mut store, &[input], &mut results)?;
3866+
func.call(&mut store, &[input], &mut results)?;
38673867

38683868
// Verify the data round-tripped correctly
38693869
match &results[0] {
@@ -3998,7 +3998,7 @@ fn map_trampoline_alignment_u32_u64() -> Result<()> {
39983998
let input = Val::Map(test_data.clone());
39993999

40004000
let mut results = [Val::Bool(false)];
4001-
func.call_and_post_return(&mut store, &[input], &mut results)?;
4001+
func.call(&mut store, &[input], &mut results)?;
40024002

40034003
match &results[0] {
40044004
Val::Map(output) => {

0 commit comments

Comments
 (0)