Extism
view release on metacpan or search on metacpan
t/02-extism.t view on Meta::CPAN
$kv_store{$key} = $value;
return;
});
ok($kv_write);
my $fplugin = Extism::Plugin->new($count_vowels_kv, {functions => [$kv_read, $kv_write], wasi => 1});
ok($fplugin);
my $hello = "Hello, World!";
$highlevel[0] = $fplugin->call("count_vowels", $hello);
$highlevel[1] = $fplugin->call("count_vowels", $hello);
}
my @decoded = map {decode_json $_} @highlevel;
ok($decoded[0]{count} == 3);
ok($decoded[0]{count} == $decoded[1]{count});
ok($decoded[0]{total} == 3);
ok($decoded[1]{total} == 6);
# Verify both sets of results are the same
is($highlevel[0], $lowlevel[0]);
is($highlevel[1], $lowlevel[1]);
# test unreachable plugin
my $unreachable = encode_json({
wasm => [
{
path => 'unreachable.wasm',
( run in 0.315 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )