From 674eb84129c7d1e74c66ed89c4ce0c3a309b9c21 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 26 Jan 2020 14:29:27 +0100 Subject: [PATCH] test for interface calls --- .../module/WasmCallInterfaceInstruction.java | 2 +- .../jwebassembly/runtime/RuntimeErrors.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/de/inetsoftware/jwebassembly/module/WasmCallInterfaceInstruction.java b/src/de/inetsoftware/jwebassembly/module/WasmCallInterfaceInstruction.java index 9e2d36e..221d5d6 100644 --- a/src/de/inetsoftware/jwebassembly/module/WasmCallInterfaceInstruction.java +++ b/src/de/inetsoftware/jwebassembly/module/WasmCallInterfaceInstruction.java @@ -58,6 +58,6 @@ class WasmCallInterfaceInstruction extends WasmCallInstruction { * {@inheritDoc} */ public void writeTo( @Nonnull ModuleWriter writer ) throws IOException { - throw new WasmException( "Interface calls not supported", getLineNumber() ); + throw new WasmException( "Interface calls are not supported.", getLineNumber() ); } } diff --git a/test/de/inetsoftware/jwebassembly/runtime/RuntimeErrors.java b/test/de/inetsoftware/jwebassembly/runtime/RuntimeErrors.java index 8b453c1..bf666b1 100644 --- a/test/de/inetsoftware/jwebassembly/runtime/RuntimeErrors.java +++ b/test/de/inetsoftware/jwebassembly/runtime/RuntimeErrors.java @@ -19,7 +19,9 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; @@ -111,4 +113,18 @@ public class RuntimeErrors { run.run(); } } + + + @Test + public void interfaceCall() throws IOException { + compileErrorTest( "Interface calls are not supported.", InterfaceMethod.class ); + } + + static class InterfaceMethod { + @Export + static int runnable() { + List list = new ArrayList(); + return list.size(); + } + } }