Path: blob/main/crates/c-api/tests/component/values.cc
1692 views
#include "utils.h"12#include <gtest/gtest.h>3#include <wasmtime.h>45#include <array>6#include <format>7#include <optional>8#include <span>9#include <variant>1011static std::string echo_component(std::string_view type, std::string_view func,12std::string_view host_params) {13return std::format(14R"END(15(component16(type $Foo' {})17(import "foo" (type $Foo (eq $Foo')))18(import "do" (func $do (param "a" $Foo) (result $Foo)))19(core module $libc20(memory (export "memory") 1)21{}22)23(core instance $libc (instantiate $libc))24(core func $do_lower (canon lower (func $do) (memory $libc "memory") (realloc (func $libc "realloc"))))2526(core module $doer27(import "host" "do" (func $do {}))28(import "libc" "memory" (memory 1))29(import "libc" "realloc" (func $realloc (param i32 i32 i32 i32) (result i32)))3031(func (export "call")32{})33)34(core instance $doer (instantiate $doer35(with "host" (instance (export "do" (func $do_lower))))36(with "libc" (instance $libc))37))3839(func $call40(param "a" $Foo)41(result $Foo)42(canon lift43(core func $doer "call")44(memory $libc "memory")45(realloc (func $libc "realloc")))46)4748(export "call" (func $call))49)50)END",51type, REALLOC_AND_FREE, host_params, func);52}5354struct Context {55wasm_engine_t *engine;56wasmtime_store_t *store;57wasmtime_context_t *context;58wasmtime_component_t *component;59wasmtime_component_instance_t instance;60wasmtime_component_func_t func;61};6263static Context create(std::string_view type, std::string_view body,64std::string_view host_params,65wasmtime_component_func_callback_t callback) {66auto component_text = echo_component(type, body, host_params);67const auto engine = wasm_engine_new();68EXPECT_NE(engine, nullptr);6970const auto store = wasmtime_store_new(engine, nullptr, nullptr);71const auto context = wasmtime_store_context(store);7273wasmtime_component_t *component = nullptr;7475auto err = wasmtime_component_new(76engine, reinterpret_cast<const uint8_t *>(component_text.data()),77component_text.size(), &component);7879CHECK_ERR(err);8081auto f = wasmtime_component_get_export_index(component, nullptr, "call",82strlen("call"));8384EXPECT_NE(f, nullptr);8586const auto linker = wasmtime_component_linker_new(engine);87const auto root = wasmtime_component_linker_root(linker);8889wasmtime_component_linker_instance_add_func(root, "do", strlen("do"),90callback, nullptr, nullptr);9192wasmtime_component_linker_instance_delete(root);9394wasmtime_component_instance_t instance = {};95err = wasmtime_component_linker_instantiate(linker, context, component,96&instance);97CHECK_ERR(err);9899wasmtime_component_linker_delete(linker);100101wasmtime_component_func_t func = {};102const auto found =103wasmtime_component_instance_get_func(&instance, context, f, &func);104EXPECT_TRUE(found);105EXPECT_NE(func.store_id, 0);106107wasmtime_component_export_index_delete(f);108109return Context{110.engine = engine,111.store = store,112.context = context,113.component = component,114.instance = instance,115.func = func,116};117}118119static void destroy(Context &ctx) {120wasmtime_component_delete(ctx.component);121wasmtime_store_delete(ctx.store);122wasm_engine_delete(ctx.engine);123}124125TEST(component, value_record) {126static const auto check = [](const wasmtime_component_val_t &val, uint64_t x,127uint64_t y) {128EXPECT_EQ(val.kind, WASMTIME_COMPONENT_RECORD);129130EXPECT_EQ(val.of.record.size, 2);131const auto entries = val.of.record.data;132133EXPECT_EQ((std::string_view{entries[0].name.data, entries[0].name.size}),134"x");135EXPECT_EQ(entries[0].val.kind, WASMTIME_COMPONENT_U64);136EXPECT_EQ(entries[0].val.of.u64, x);137138EXPECT_EQ((std::string_view{entries[1].name.data, entries[1].name.size}),139"y");140EXPECT_EQ(entries[1].val.kind, WASMTIME_COMPONENT_U64);141EXPECT_EQ(entries[1].val.of.u64, y);142};143144static const auto make = [](uint64_t x,145uint64_t y) -> wasmtime_component_val_t {146auto ret = wasmtime_component_val_t{147.kind = WASMTIME_COMPONENT_RECORD,148};149150wasmtime_component_valrecord_new_uninit(&ret.of.record, 2);151152const auto entries = ret.of.record.data;153wasm_name_new_from_string(&entries[0].name, "x");154entries[0].val.kind = WASMTIME_COMPONENT_U64;155entries[0].val.of.u64 = x;156wasm_name_new_from_string(&entries[1].name, "y");157entries[1].val.kind = WASMTIME_COMPONENT_U64;158entries[1].val.of.u64 = y;159160return ret;161};162163auto ctx = create(164R"((record (field "x" u64) (field "y" u64)))", R"(165(param $x i64)166(param $y i64)167(result i32)168(local $res i32)169local.get $x170local.get $y171(call $realloc172(i32.const 0)173(i32.const 0)174(i32.const 4)175(i32.const 16))176local.tee $res177call $do178local.get $res179)",180"(param i64 i64 i32)",181+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,182size_t args_len, wasmtime_component_val_t *rets,183size_t rets_len) -> wasmtime_error_t * {184EXPECT_EQ(args_len, 1);185check(args[0], 1, 2);186187EXPECT_EQ(rets_len, 1);188rets[0] = make(3, 4);189190return nullptr;191});192193auto arg = make(1, 2);194auto res = wasmtime_component_val_t{};195196auto err =197wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);198CHECK_ERR(err);199200err = wasmtime_component_func_post_return(&ctx.func, ctx.context);201CHECK_ERR(err);202203check(res, 3, 4);204205wasmtime_component_val_delete(&arg);206wasmtime_component_val_delete(&res);207208destroy(ctx);209}210211TEST(component, value_string) {212static const auto check = [](const wasmtime_component_val_t &val,213std::string_view text) {214EXPECT_EQ(val.kind, WASMTIME_COMPONENT_STRING);215EXPECT_EQ((std::string_view{val.of.string.data, val.of.string.size}), text);216};217218static const auto make =219[](std::string_view text) -> wasmtime_component_val_t {220auto str = wasm_name_t{};221wasm_name_new_from_string(&str, text.data());222223return wasmtime_component_val_t{224.kind = WASMTIME_COMPONENT_STRING,225.of = {.string = str},226};227};228229auto ctx = create(230R"(string)", R"(231(param $x i32)232(param $y i32)233(result i32)234(local $res i32)235local.get $x236local.get $y237(call $realloc238(i32.const 0)239(i32.const 0)240(i32.const 4)241(i32.const 8))242local.tee $res243call $do244local.get $res245)",246"(param i32 i32 i32)",247+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,248size_t args_len, wasmtime_component_val_t *rets,249size_t rets_len) -> wasmtime_error_t * {250EXPECT_EQ(args_len, 1);251check(args[0], "hello from A!");252253EXPECT_EQ(rets_len, 1);254rets[0] = make("hello from B!");255256return nullptr;257});258259auto arg = make("hello from A!");260auto res = wasmtime_component_val_t{};261262auto err =263wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);264CHECK_ERR(err);265266err = wasmtime_component_func_post_return(&ctx.func, ctx.context);267CHECK_ERR(err);268269check(res, "hello from B!");270271wasmtime_component_val_delete(&arg);272wasmtime_component_val_delete(&res);273274destroy(ctx);275}276277TEST(component, value_list) {278static const auto check = [](const wasmtime_component_val_t &val,279std::vector<uint32_t> data) {280EXPECT_EQ(val.kind, WASMTIME_COMPONENT_LIST);281auto vals = std::span{val.of.list.data, val.of.list.size};282EXPECT_EQ(vals.size(), data.size());283for (auto i = 0; i < data.size(); i++) {284EXPECT_EQ(vals[i].kind, WASMTIME_COMPONENT_U32);285EXPECT_EQ(vals[i].of.u32, data[i]);286}287};288289static const auto make =290[](std::vector<uint32_t> data) -> wasmtime_component_val_t {291auto ret = wasmtime_component_val_t{292.kind = WASMTIME_COMPONENT_LIST,293};294295wasmtime_component_vallist_new_uninit(&ret.of.list, data.size());296297for (auto i = 0; i < data.size(); i++) {298ret.of.list.data[i] = wasmtime_component_val_t{299.kind = WASMTIME_COMPONENT_U32,300.of = {.u32 = data[i]},301};302}303304return ret;305};306307auto ctx = create(308R"((list u32))", R"(309(param $x i32)310(param $y i32)311(result i32)312(local $res i32)313local.get $x314local.get $y315(call $realloc316(i32.const 0)317(i32.const 0)318(i32.const 4)319(i32.const 8))320local.tee $res321call $do322local.get $res323)",324"(param i32 i32 i32)",325+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,326size_t args_len, wasmtime_component_val_t *rets,327size_t rets_len) -> wasmtime_error_t * {328EXPECT_EQ(args_len, 1);329check(args[0], {1, 2, 3});330331EXPECT_EQ(rets_len, 1);332rets[0] = make({4, 5, 6, 7});333334return nullptr;335});336337auto arg = make({1, 2, 3});338auto res = wasmtime_component_val_t{};339340auto err =341wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);342CHECK_ERR(err);343344err = wasmtime_component_func_post_return(&ctx.func, ctx.context);345CHECK_ERR(err);346347check(res, {4, 5, 6, 7});348349wasmtime_component_val_delete(&arg);350wasmtime_component_val_delete(&res);351352destroy(ctx);353}354355TEST(component, value_tuple) {356static const auto check = [](const wasmtime_component_val_t &val,357std::vector<uint32_t> data) {358EXPECT_EQ(val.kind, WASMTIME_COMPONENT_TUPLE);359auto vals = std::span{val.of.tuple.data, val.of.tuple.size};360EXPECT_EQ(vals.size(), data.size());361for (auto i = 0; i < data.size(); i++) {362EXPECT_EQ(vals[i].kind, WASMTIME_COMPONENT_U32);363EXPECT_EQ(vals[i].of.u32, data[i]);364}365};366367static const auto make =368[](std::vector<uint32_t> data) -> wasmtime_component_val_t {369auto ret = wasmtime_component_val_t{370.kind = WASMTIME_COMPONENT_TUPLE,371};372373wasmtime_component_valtuple_new_uninit(&ret.of.tuple, data.size());374375for (auto i = 0; i < data.size(); i++) {376ret.of.list.data[i] = wasmtime_component_val_t{377.kind = WASMTIME_COMPONENT_U32,378.of = {.u32 = data[i]},379};380}381382return ret;383};384385auto ctx = create(386R"((tuple u32 u32 u32))", R"(387(param $x i32)388(param $y i32)389(param $z i32)390(result i32)391(local $res i32)392local.get $x393local.get $y394local.get $z395(call $realloc396(i32.const 0)397(i32.const 0)398(i32.const 4)399(i32.const 12))400local.tee $res401call $do402local.get $res403)",404"(param i32 i32 i32 i32)",405+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,406size_t args_len, wasmtime_component_val_t *rets,407size_t rets_len) -> wasmtime_error_t * {408EXPECT_EQ(args_len, 1);409check(args[0], {1, 2, 3});410411EXPECT_EQ(rets_len, 1);412rets[0] = make({4, 5, 6});413414return nullptr;415});416417auto arg = make({1, 2, 3});418auto res = wasmtime_component_val_t{};419420auto err =421wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);422CHECK_ERR(err);423424err = wasmtime_component_func_post_return(&ctx.func, ctx.context);425CHECK_ERR(err);426427check(res, {4, 5, 6});428429wasmtime_component_val_delete(&arg);430wasmtime_component_val_delete(&res);431432destroy(ctx);433}434435TEST(component, value_variant) {436static const auto check_aa = [](const wasmtime_component_val_t &val,437uint32_t value) {438EXPECT_EQ(val.kind, WASMTIME_COMPONENT_VARIANT);439EXPECT_EQ((std::string_view{val.of.variant.discriminant.data,440val.of.variant.discriminant.size}),441"aa");442443EXPECT_NE(val.of.variant.val, nullptr);444445EXPECT_EQ(val.of.variant.val->kind, WASMTIME_COMPONENT_U32);446EXPECT_EQ(val.of.variant.val->of.u32, value);447};448449static const auto check_bb = [](const wasmtime_component_val_t &val,450std::string_view value) {451EXPECT_EQ(val.kind, WASMTIME_COMPONENT_VARIANT);452EXPECT_EQ((std::string_view{val.of.variant.discriminant.data,453val.of.variant.discriminant.size}),454"bb");455456EXPECT_NE(val.of.variant.val, nullptr);457458EXPECT_EQ(val.of.variant.val->kind, WASMTIME_COMPONENT_STRING);459EXPECT_EQ((std::string_view{val.of.variant.val->of.string.data,460val.of.variant.val->of.string.size}),461value);462};463464static const auto make_aa = [](uint32_t value) -> wasmtime_component_val_t {465auto ret = wasmtime_component_val_t{466.kind = WASMTIME_COMPONENT_VARIANT,467};468469wasm_name_new_from_string(&ret.of.variant.discriminant, "aa");470471ret.of.variant.val = wasmtime_component_val_new();472ret.of.variant.val->kind = WASMTIME_COMPONENT_U32;473ret.of.variant.val->of.u32 = value;474475return ret;476};477478static const auto make_bb =479[](std::string_view value) -> wasmtime_component_val_t {480auto ret = wasmtime_component_val_t{481.kind = WASMTIME_COMPONENT_VARIANT,482};483484wasm_name_new_from_string(&ret.of.variant.discriminant, "bb");485486ret.of.variant.val = wasmtime_component_val_new();487ret.of.variant.val->kind = WASMTIME_COMPONENT_STRING;488wasm_name_new(&ret.of.variant.val->of.string, value.size(), value.data());489490return ret;491};492493auto ctx = create(494R"(495(variant496(case "aa" u32)497(case "bb" string)498)499)",500R"(501(param $x i32)502(param $y i32)503(param $z i32)504(result i32)505(local $res i32)506local.get $x507local.get $y508local.get $z509(call $realloc510(i32.const 0)511(i32.const 0)512(i32.const 4)513(i32.const 12))514local.tee $res515call $do516local.get $res517)",518"(param i32 i32 i32 i32)",519+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,520size_t args_len, wasmtime_component_val_t *rets,521size_t rets_len) -> wasmtime_error_t * {522EXPECT_EQ(args_len, 1);523check_aa(args[0], 123);524525EXPECT_EQ(rets_len, 1);526rets[0] = make_bb("textt");527528return nullptr;529});530531auto arg = make_aa(123);532auto res = wasmtime_component_val_t{};533534auto err =535wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);536CHECK_ERR(err);537538err = wasmtime_component_func_post_return(&ctx.func, ctx.context);539CHECK_ERR(err);540541check_bb(res, "textt");542543wasmtime_component_val_delete(&arg);544wasmtime_component_val_delete(&res);545546destroy(ctx);547}548549TEST(component, value_enum) {550static const auto check = [](const wasmtime_component_val_t &val,551std::string_view text) {552EXPECT_EQ(val.kind, WASMTIME_COMPONENT_ENUM);553EXPECT_EQ(554(std::string_view{val.of.enumeration.data, val.of.enumeration.size}),555text);556};557558static const auto make =559[](std::string_view text) -> wasmtime_component_val_t {560auto ret = wasmtime_component_val_t{561.kind = WASMTIME_COMPONENT_ENUM,562};563564wasm_name_new(&ret.of.enumeration, text.size(), text.data());565566return ret;567};568569auto ctx = create(570R"((enum "aa" "bb"))", R"(571(param $x i32)572(result i32)573local.get $x574call $do575)",576"(param i32) (result i32)",577+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,578size_t args_len, wasmtime_component_val_t *rets,579size_t rets_len) -> wasmtime_error_t * {580EXPECT_EQ(args_len, 1);581check(args[0], "aa");582583EXPECT_EQ(rets_len, 1);584rets[0] = make("bb");585586return nullptr;587});588589auto arg = make("aa");590auto res = wasmtime_component_val_t{};591592auto err =593wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);594CHECK_ERR(err);595596err = wasmtime_component_func_post_return(&ctx.func, ctx.context);597CHECK_ERR(err);598599check(res, "bb");600601wasmtime_component_val_delete(&arg);602wasmtime_component_val_delete(&res);603604destroy(ctx);605}606607TEST(component, value_option) {608static const auto check = [](const wasmtime_component_val_t &val,609std::optional<uint32_t> value) {610EXPECT_EQ(val.kind, WASMTIME_COMPONENT_OPTION);611612if (value.has_value()) {613EXPECT_NE(val.of.option, nullptr);614EXPECT_EQ(val.of.option->kind, WASMTIME_COMPONENT_U32);615EXPECT_EQ(val.of.option->of.u32, *value);616} else {617EXPECT_EQ(val.of.option, nullptr);618}619};620621static const auto make =622[](std::optional<uint32_t> value) -> wasmtime_component_val_t {623auto ret = wasmtime_component_val_t{624.kind = WASMTIME_COMPONENT_OPTION,625.of = {.option = nullptr},626};627628if (value.has_value()) {629ret.of.option = wasmtime_component_val_new();630*ret.of.option = wasmtime_component_val_t{631.kind = WASMTIME_COMPONENT_U32,632.of = {.u32 = *value},633};634}635636return ret;637};638639auto ctx = create(640R"((option u32))", R"(641(param $x i32)642(param $y i32)643(result i32)644(local $res i32)645local.get $x646local.get $y647(call $realloc648(i32.const 0)649(i32.const 0)650(i32.const 4)651(i32.const 8))652local.tee $res653call $do654local.get $res655)",656"(param i32 i32 i32)",657+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,658size_t args_len, wasmtime_component_val_t *rets,659size_t rets_len) -> wasmtime_error_t * {660EXPECT_EQ(args_len, 1);661check(args[0], 123);662663EXPECT_EQ(rets_len, 1);664rets[0] = make({});665666return nullptr;667});668669auto arg = make(123);670auto res = wasmtime_component_val_t{};671672auto err =673wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);674CHECK_ERR(err);675676err = wasmtime_component_func_post_return(&ctx.func, ctx.context);677CHECK_ERR(err);678679check(res, {});680681wasmtime_component_val_delete(&arg);682wasmtime_component_val_delete(&res);683684destroy(ctx);685}686687TEST(component, value_result) {688static const auto check = [](const wasmtime_component_val_t &val,689bool expected_is_ok, uint32_t expected_value) {690EXPECT_EQ(val.kind, WASMTIME_COMPONENT_RESULT);691692EXPECT_EQ(val.of.result.is_ok, expected_is_ok);693EXPECT_NE(val.of.result.val, nullptr);694695EXPECT_EQ(val.of.result.val->kind, WASMTIME_COMPONENT_U32);696EXPECT_EQ(val.of.result.val->of.u32, expected_value);697};698699static const auto make = [](bool is_ok,700uint32_t value) -> wasmtime_component_val_t {701auto ret = wasmtime_component_val_t{702.kind = WASMTIME_COMPONENT_RESULT,703};704705const auto inner = wasmtime_component_val_new();706inner->kind = WASMTIME_COMPONENT_U32;707inner->of.u32 = value;708709ret.of.result = {710.is_ok = is_ok,711.val = inner,712};713714return ret;715};716717auto ctx = create(718R"((result u32 (error u32)))", R"(719(param $x i32)720(param $y i32)721(result i32)722(local $res i32)723local.get $x724local.get $y725(call $realloc726(i32.const 0)727(i32.const 0)728(i32.const 4)729(i32.const 8))730local.tee $res731call $do732local.get $res733)",734"(param i32 i32 i32)",735+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,736size_t args_len, wasmtime_component_val_t *rets,737size_t rets_len) -> wasmtime_error_t * {738EXPECT_EQ(args_len, 1);739check(args[0], true, 123);740741EXPECT_EQ(rets_len, 1);742rets[0] = make(false, 456);743744return nullptr;745});746747auto arg = make(true, 123);748auto res = wasmtime_component_val_t{};749750auto err =751wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);752CHECK_ERR(err);753754err = wasmtime_component_func_post_return(&ctx.func, ctx.context);755CHECK_ERR(err);756757check(res, false, 456);758759wasmtime_component_val_delete(&arg);760wasmtime_component_val_delete(&res);761762destroy(ctx);763}764765TEST(component, value_flags) {766static const auto check = [](const wasmtime_component_val_t &val,767std::vector<std::string> data) {768EXPECT_EQ(val.kind, WASMTIME_COMPONENT_FLAGS);769auto flags = std::span{val.of.flags.data, val.of.flags.size};770EXPECT_EQ(flags.size(), data.size());771for (auto i = 0; i < data.size(); i++) {772EXPECT_EQ((std::string_view{flags[i].data, flags[i].size}), data[i]);773}774};775776static const auto make =777[](std::vector<std::string> data) -> wasmtime_component_val_t {778auto ret = wasmtime_component_val_t{779.kind = WASMTIME_COMPONENT_FLAGS,780};781782wasmtime_component_valflags_new_uninit(&ret.of.flags, data.size());783784for (auto i = 0; i < data.size(); i++) {785wasm_name_new(&ret.of.flags.data[i], data[i].size(), data[i].data());786}787788return ret;789};790791auto ctx = create(792R"((flags "aa" "bb"))", R"(793(param $x i32)794(result i32)795local.get $x796call $do797)",798"(param i32) (result i32)",799+[](void *, wasmtime_context_t *, const wasmtime_component_val_t *args,800size_t args_len, wasmtime_component_val_t *rets,801size_t rets_len) -> wasmtime_error_t * {802EXPECT_EQ(args_len, 1);803check(args[0], {"aa"});804805EXPECT_EQ(rets_len, 1);806rets[0] = make({"aa", "bb"});807808return nullptr;809});810811auto arg = make({"aa"});812auto res = wasmtime_component_val_t{};813814auto err =815wasmtime_component_func_call(&ctx.func, ctx.context, &arg, 1, &res, 1);816CHECK_ERR(err);817818err = wasmtime_component_func_post_return(&ctx.func, ctx.context);819CHECK_ERR(err);820821check(res, {"aa", "bb"});822823wasmtime_component_val_delete(&arg);824wasmtime_component_val_delete(&res);825826destroy(ctx);827}828829TEST(component, value_list_inner) {830{831auto x = wasmtime_component_val_t{832.kind = WASMTIME_COMPONENT_LIST,833};834wasmtime_component_vallist_new_empty(&x.of.list);835EXPECT_EQ(x.of.list.data, nullptr);836EXPECT_EQ(x.of.list.size, 0);837838wasmtime_component_vallist_new_uninit(&x.of.list, 1);839EXPECT_NE(x.of.list.data, nullptr);840EXPECT_EQ(x.of.list.size, 1);841842wasmtime_component_vallist_delete(&x.of.list);843844auto items = std::array{845wasmtime_component_val_t{846.kind = WASMTIME_COMPONENT_U32,847.of = {.u32 = 123},848},849};850851wasmtime_component_vallist_new(&x.of.list, items.size(), items.data());852EXPECT_NE(x.of.list.data, nullptr);853EXPECT_EQ(x.of.list.size, 1);854855EXPECT_EQ(x.of.list.data[0].kind, WASMTIME_COMPONENT_U32);856EXPECT_EQ(x.of.list.data[0].of.u32, 123);857858auto clone = wasmtime_component_val_t{859.kind = WASMTIME_COMPONENT_LIST,860};861862wasmtime_component_vallist_copy(&clone.of.list, &x.of.list);863wasmtime_component_vallist_delete(&x.of.list);864865EXPECT_NE(clone.of.list.data, nullptr);866EXPECT_EQ(clone.of.list.size, 1);867868EXPECT_EQ(clone.of.list.data[0].kind, WASMTIME_COMPONENT_U32);869EXPECT_EQ(clone.of.list.data[0].of.u32, 123);870871wasmtime_component_vallist_delete(&clone.of.list);872}873}874875876