forked from roastedroot/proxy-wasm-java-host
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRustHelloWorldTest.java
More file actions
28 lines (22 loc) · 952 Bytes
/
RustHelloWorldTest.java
File metadata and controls
28 lines (22 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package io.roastedroot.proxywasm.examples;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.dylibso.chicory.wasm.Parser;
import io.roastedroot.proxywasm.ProxyWasm;
import io.roastedroot.proxywasm.StartException;
import java.nio.file.Path;
import org.junit.jupiter.api.Test;
/**
* Test loading https://github.com/proxy-wasm/proxy-wasm-rust-sdk/tree/c8b2335df66a569a6306c58e346dd0cf9dbc0f3a/examples/hello_world
*/
public class RustHelloWorldTest {
@Test
public void pauseUntilEOS() throws StartException {
var handler = new MockHandler();
var module = Parser.parse(Path.of("./src/test/rust-examples/hello_world/main.wasm"));
try (var host = ProxyWasm.builder().withPluginHandler(handler).build(module)) {
handler.assertLogsEqual("Hello, World!");
host.tick();
assertTrue(handler.loggedMessages().get(1).contains("your lucky number is"));
}
}
}