Skip to content

Commit 350366c

Browse files
authored
Add tests to make sure LoadModule[Text] doesn't close the stream
1 parent 25d766f commit 350366c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/ModuleLoadTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ public void ItLoadsModuleFromEmbeddedResource()
1616

1717
using var host = new Host();
1818
host.LoadModule("hello.wasm", stream).Should().NotBeNull();
19+
20+
// `LoadModule` is not supposed to close the supplied stream,
21+
// so the following statement should complete without throwing
22+
// `ObjectDisposedException`
23+
stream.Read(new byte[0], 0, 0);
1924
}
2025

2126
[Fact]
@@ -26,6 +31,11 @@ public void ItLoadsModuleTextFromEmbeddedResource()
2631

2732
using var host = new Host();
2833
host.LoadModuleText("hello.wat", stream).Should().NotBeNull();
34+
35+
// `LoadModuleText` is not supposed to close the supplied stream,
36+
// so the following statement should complete without throwing
37+
// `ObjectDisposedException`
38+
stream.Read(new byte[0], 0, 0);
2939
}
3040
}
3141
}

0 commit comments

Comments
 (0)