From 98db425b9cd03ef0af0f7cd95816e7a697a9b28a Mon Sep 17 00:00:00 2001 From: Patrick Smith Date: Wed, 28 Aug 2024 21:17:54 -0400 Subject: [PATCH] todo: compile to check we actually return (i32 i32) for each Str from I32.match Probably need to add a match or cond DSL --- test/i32/conveniences_test.exs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/test/i32/conveniences_test.exs b/test/i32/conveniences_test.exs index bb005ec..b7f5ca5 100644 --- a/test/i32/conveniences_test.exs +++ b/test/i32/conveniences_test.exs @@ -150,18 +150,23 @@ defmodule I32ConveniencesTest do end test "I32.match output string constant" do - assert (TestHelper.module_wat do - use Orb + wat = + TestHelper.module_wat do + use Orb - defw get_path(), I32.U8.UnsafePointer, state: I32 do - state = 0 + defw get_path(), Str, state: I32 do + state = 0 - I32.match state do - 0 -> ~S[/initial] - 1 -> ~S[/disconnected] - end - end - end) =~ "/initial" + I32.match state do + 0 -> ~S[/initial] + 1 -> ~S[/disconnected] + end + end + end + + assert wat =~ "/initial" + + # TODO: compile to check we actually return (i32 i32) for each Str. end test "can return string constant" do