Ability to provide unique module with name as the main
@@ -64,20 +64,27 @@ class WasmVmSpec extends WordSpec with Matchers {
}
"initialize Vm success" when {
- "one main module is specified" in {
+ "one module without name is provided" in {
val sumFile = getClass.getResource("/wast/sum.wast").getPath
WasmVm[IO](NonEmptyList.one(sumFile), MemoryHasher[IO]).success()
}
- "two modules with different module names are specified" in {
+ "one module with name is provided" in {
+ // Mul modules have name
+ val mulFile = getClass.getResource("/wast/mul.wast").getPath
+
+ WasmVm[IO](NonEmptyList.one(mulFile), MemoryHasher[IO]).success()
+ }
+
+ "two modules with different module names are provided" in {
val sumFile = getClass.getResource("/wast/sum.wast").getPath
val mulFile = getClass.getResource("/wast/mul.wast").getPath
WasmVm[IO](NonEmptyList.of(mulFile, sumFile), MemoryHasher[IO]).success()
}
- "two modules with functions with the same names are specified" in {
+ "two modules with functions with the same names are provided" in {
// module without name and with some functions with the same name ("allocate", "deallocate", "invoke", ...)
val sum1File = getClass.getResource("/wast/counter.wast").getPath
// module with name "Sum" and with some functions with the same name ("allocate", "deallocate", "invoke", ...)
@@ -93,14 +100,7 @@ class WasmVmSpec extends WordSpec with Matchers {
}
"initialize Vm failed" when {
- "one side module is specified" in {
- // Mul modules doesn't have name
- val sumFile = getClass.getResource("/wast/mul.wast").getPath
-
- WasmVm[IO](NonEmptyList.one(sumFile), MemoryHasher[IO]).failed()
- }
-
- "two main modules specified" in {
+ "two main modules provided" in {
// these modules both don't contain a name section
val sumFile = getClass.getResource("/wast/sum.wast").getPath
val mulFile = getClass.getResource("/wast/bad-allocation-function-i64.wast").getPath
