From be13488f69695c8fe5663928f5b1cf867f6da8c3 Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Wed, 23 Aug 2023 22:58:19 -0600 Subject: [PATCH] update tests and fix some --- src/Language/Wasm/Lexer.x | 4 +++- src/Language/Wasm/Script.hs | 1 + tests/Test.hs | 2 +- tests/spec | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Language/Wasm/Lexer.x b/src/Language/Wasm/Lexer.x index c3f03d0..45ce0b0 100644 --- a/src/Language/Wasm/Lexer.x +++ b/src/Language/Wasm/Lexer.x @@ -299,7 +299,9 @@ endBlockComment _inp _len = do alexMonadScan startStringLiteral :: AlexAction Lexeme -startStringLiteral _inp _len = do +startStringLiteral (_, prev, _, _) _len = do + when (prev `notElem` "() \x09\x0A\x0D") + $ alexError "string literal should start after space or parent character" alexSetStartCode stringLiteral setLexerStringFlag True alexMonadScan diff --git a/src/Language/Wasm/Script.hs b/src/Language/Wasm/Script.hs index a5e827a..1c89984 100644 --- a/src/Language/Wasm/Script.hs +++ b/src/Language/Wasm/Script.hs @@ -56,6 +56,7 @@ runScript onAssertFail script = do (st, inst) <- Interpreter.makeHostModule Interpreter.emptyStore [ ("print", hostPrint []), ("print_i32", hostPrint [Struct.I32]), + ("print_i64", hostPrint [Struct.I64]), ("print_i32_f32", hostPrint [Struct.I32, Struct.F32]), ("print_f64_f64", hostPrint [Struct.F64, Struct.F64]), ("print_f32", hostPrint [Struct.F32]), diff --git a/tests/Test.hs b/tests/Test.hs index 657a1e2..d2fa40c 100644 --- a/tests/Test.hs +++ b/tests/Test.hs @@ -19,7 +19,7 @@ main = do files <- filter (not . List.isPrefixOf "simd") . filter (List.isSuffixOf ".wast") <$> Directory.listDirectory "tests/spec" - -- let files = ["bulk.wast"] + -- let files = ["tokens.wast"] scriptTestCases <- (`mapM` files) $ \file -> do test <- LBS.readFile ("tests/spec/" ++ file) return $ testCase file $ do diff --git a/tests/spec b/tests/spec index 6241ce9..b25bf82 160000 --- a/tests/spec +++ b/tests/spec @@ -1 +1 @@ -Subproject commit 6241ce9e153e83ae281998ea8c9f54fe7748ee7c +Subproject commit b25bf823719c17452fd7bc1fa69697dcd5bdf3ec