1
1
mirror of https://github.com/github/semantic.git synced 2024-12-25 07:55:12 +03:00

Re-work these tests now that we return if parse fails

This commit is contained in:
Timothy Clem 2018-08-30 12:51:29 -07:00
parent bec7e0ea88
commit 099faacbce

View File

@ -11,10 +11,13 @@ import SpecHelpers
spec :: Spec spec :: Spec
spec = parallel $ do spec = parallel $ do
describe "parseBlob" $ do describe "parseBlob" $ do
it "throws if given an unknown language" $ do it "returns error if given an unknown language (json)" $ do
runTask (runParse SExpressionTermRenderer [methodsBlob { blobLanguage = Unknown }]) `shouldThrow` (\ code -> case code of output <- fmap runBuilder . runTask $ runParse JSONTermRenderer [ methodsBlob { blobLanguage = Unknown } ]
ExitFailure 1 -> True output `shouldBe` "{\"trees\":[{\"error\":{\"path\":\"methods.rb\",\"language\":\"Unknown\",\"message\":\"NoLanguageForBlob \\\"methods.rb\\\"\"}}]}\n"
_ -> False)
it "drops results for sexpression output" $ do
output <- fmap runBuilder . runTask $ runParse SExpressionTermRenderer [ methodsBlob { blobLanguage = Unknown } ]
output `shouldBe` ""
it "renders with the specified renderer" $ do it "renders with the specified renderer" $ do
output <- fmap runBuilder . runTask $ runParse SExpressionTermRenderer [methodsBlob] output <- fmap runBuilder . runTask $ runParse SExpressionTermRenderer [methodsBlob]