1 Commits

Author SHA1 Message Date
Ilya Rezvov 825a24d59c add reference types test to test suite 2021-04-25 12:24:47 -07:00
2 changed files with 18 additions and 12 deletions
+17 -11
View File
@@ -16,14 +16,20 @@ import qualified Data.List as List
main :: IO () main :: IO ()
main = do main = do
files <- filter (List.isSuffixOf ".wast") <$> Directory.listDirectory "tests/spec" let groups = [
-- let files = ["const.wast"] ("Core Tests", "tests/spec"),
scriptTestCases <- (`mapM` files) $ \file -> do ("Reference Types Proposal", "tests/spec/proposals/reference-types")
test <- LBS.readFile ("tests/spec/" ++ file) ]
return $ testCase file $ do testGroups <- (`mapM` groups) $ \(groupName, dir) -> do
case Wasm.parseScript test of files <- filter (List.isSuffixOf ".wast") <$> Directory.listDirectory dir
Right script -> -- let files = ["const.wast"]
Script.runScript (\msg assert -> assertFailure ("Failed assert: " ++ msg ++ ". Assert " ++ show assert)) script scriptTestCases <- (`mapM` files) $ \file -> do
Left error -> test <- LBS.readFile (dir ++ "/" ++ file)
assertFailure $ "Failed to parse with error: " ++ show error return $ testCase file $ do
defaultMain $ testGroup "Wasm Core Test Suit" scriptTestCases case Wasm.parseScript test of
Right script ->
Script.runScript (\msg assert -> assertFailure ("Failed assert: " ++ msg ++ ". Assert " ++ show assert)) script
Left error ->
assertFailure $ "Failed to parse with error: " ++ show error
return $ testGroup groupName scriptTestCases
defaultMain $ testGroup "Wasm Test Suit" testGroups