* Add a wasmtime-specific `wasmtime_wat2wasm` C API This commit implements a wasmtime-specific C API for converting the text format to the binary format. An upstream spec issue exists for adding this to the C API, but in the meantime we can experiment with our own version of this API and use it in the C# extension, for example! Closes #1000 * Reorder arguments * Use wasm_byte_vec_t for input `*.wat` * Mark wat input as const * Return an error message and use `fixed` * Actually include the error message * Use `fixed` in `Module.cs` as well
35 lines
934 B
C#
35 lines
934 B
C#
using System;
|
|
using FluentAssertions;
|
|
using Xunit;
|
|
|
|
namespace Wasmtime.Tests
|
|
{
|
|
public class MemoryImportFromModuleFixture : ModuleFixture
|
|
{
|
|
protected override string ModuleFileName => "MemoryImportFromModule.wat";
|
|
}
|
|
|
|
public class MemoryImportFromModuleTests : IClassFixture<MemoryImportFromModuleFixture>
|
|
{
|
|
public MemoryImportFromModuleTests(MemoryImportFromModuleFixture fixture)
|
|
{
|
|
Fixture = fixture;
|
|
}
|
|
|
|
private MemoryImportFromModuleFixture Fixture { get; set; }
|
|
|
|
[Fact]
|
|
public void ItHasTheExpectedImport()
|
|
{
|
|
Fixture.Module.Imports.Memories.Count.Should().Be(1);
|
|
|
|
var memory = Fixture.Module.Imports.Memories[0];
|
|
|
|
memory.ModuleName.Should().Be("js");
|
|
memory.Name.Should().Be("mem");
|
|
memory.Minimum.Should().Be(1);
|
|
memory.Maximum.Should().Be(2);
|
|
}
|
|
}
|
|
}
|