Skip to content

Commit

Permalink
refactor: changed spec arguments into specification
Browse files Browse the repository at this point in the history
To avoid name clashing with the test spec (which is also called `spec`)
  • Loading branch information
DavidMazarro committed Jun 16, 2023
1 parent df063b4 commit 378d33a
Showing 1 changed file with 18 additions and 20 deletions.
38 changes: 18 additions & 20 deletions test/WasmVerify/WasmVerifySpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ import qualified Data.ByteString as BS
import Data.Either (fromRight)
import qualified Language.Wasm as Wasm
import qualified Language.Wasm.Structure as Wasm
import qualified Language.Wasm.Validate as Wasm
import Path
import System.Directory
import Test.Hspec
import qualified VerifiWASM.LangTypes as VerifiWASM
import System.IO.Silently (silence)
import Test.Hspec hiding (example)
import VerifiWASM.Parser (parseVerifiWASMFile)
import WasmVerify
import System.IO.Silently (silence)

spec :: Spec
spec = do
Expand All @@ -31,7 +29,7 @@ spec = do
mAltSpec <- parseVerifiWASMFile altSpecPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True
maybe
Expand All @@ -49,7 +47,7 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True

Expand All @@ -62,7 +60,7 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True

Expand All @@ -75,9 +73,9 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True
`shouldReturn` Just True

context "when verifying examples/example_br_table.wasm" $ do
it "the verification is successful" $ do
Expand All @@ -88,9 +86,9 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True
`shouldReturn` Just True

context "when verifying examples/fib.wasm" $ do
it "the verification is successful" $ do
Expand All @@ -103,12 +101,12 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmAltModule))
(\specification -> Just <$> silence (verifyModule specification wasmAltModule))
mSpec
`shouldReturn` Just True

Expand All @@ -121,10 +119,10 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True
`shouldReturn` Just True

context "when verifying examples/no_return_fib.wasm" $ do
it "the verification is successful" $ do
projectPath <- parseAbsDir =<< getCurrentDirectory
Expand All @@ -134,9 +132,9 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True
`shouldReturn` Just True

context "when verifying examples/select.wasm" $ do
it "the verification is successful" $ do
Expand All @@ -147,9 +145,9 @@ spec = do
mSpec <- parseVerifiWASMFile specPath
maybe
(pure Nothing)
(\spec -> Just <$> silence (verifyModule spec wasmModule))
(\specification -> Just <$> silence (verifyModule specification wasmModule))
mSpec
`shouldReturn` Just True
`shouldReturn` Just True

describe "loadModuleFromFile" $ do
context "given an existing and valid WASM binary file" $
Expand Down

0 comments on commit 378d33a

Please sign in to comment.