Skip to content

Commit

Permalink
Test if Applicative.empty behaves as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Jul 23, 2017
1 parent e9d5302 commit 8240f1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/Foreign/LuaTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Foreign.LuaTest (tests) where

import Prelude hiding (concat)

import Control.Applicative ((<|>))
import Control.Applicative ((<|>), empty)
import Control.Monad (when)
import Data.ByteString (ByteString)
import Data.Either (isLeft, isRight)
Expand Down Expand Up @@ -154,6 +154,9 @@ tests = testGroup "lua integration tests"
assertEqual "alternative failed" (Right True) =<<
runLuaEither (throwLuaError "test" <|> return True)

, testCase "Control.Applicative.empty implementation throws an exception" $
assertBool "empty doesn't throw" . isLeft =<< runLuaEither empty

, testCase "calling a function that errors throws exception" $
let msg = "error message"
luaCode = "return error('" ++ msg ++ "')"
Expand Down

0 comments on commit 8240f1c

Please sign in to comment.