1
1
mirror of https://github.com/github/semantic.git synced 2024-11-25 21:43:07 +03:00
semantic/test/Semantic/Spec.hs
Patrick Thomson 10a863f57c Fix tests
2018-06-04 18:26:47 -04:00

24 lines
733 B
Haskell

module Semantic.Spec (spec) where
import Data.Diff
import Data.Patch
import Semantic.Parse
import System.Exit
import SpecHelpers
spec :: Spec
spec = parallel $ do
describe "parseBlob" $ do
it "throws if given an unknown language" $ do
runTask (runParse SExpressionTermRenderer [methodsBlob { blobLanguage = Unknown }]) `shouldThrow` (\ code -> case code of
ExitFailure 1 -> True
_ -> False)
it "renders with the specified renderer" $ do
output <- fmap runBuilder . runTask $ runParse SExpressionTermRenderer [methodsBlob]
output `shouldBe` "(Statements\n (Method\n (Empty)\n (Identifier)\n (Statements)))\n"
where
methodsBlob = Blob "def foo\nend\n" "methods.rb" Ruby