wasp/waspc/test/Parser/ExternalCodeTest.hs
2020-02-20 12:30:58 +01:00

21 lines
688 B
Haskell

module Parser.ExternalCodeTest where
import Test.Tasty.Hspec
import Data.Either (isLeft)
import Path (relfile)
import Parser.ExternalCode (extCodeFilePathString)
import Parser.Common (runWaspParser)
spec_ParserExternalCode :: Spec
spec_ParserExternalCode = do
describe "Parsing external code file path string" $ do
it "Correctly parses external code path in double quotes" $ do
runWaspParser extCodeFilePathString "\"@ext/foo/bar.txt\""
`shouldBe` Right [relfile|foo/bar.txt|]
it "When path does not start with @ext/, returns Left" $ do
isLeft (runWaspParser extCodeFilePathString "\"@ext2/foo/bar.txt\"") `shouldBe` True