Skip to content

Commit

Permalink
Export and test GC constants
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Jul 8, 2017
1 parent 91b6296 commit 1e9af42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Foreign/Lua/Api/Types.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Portability : ForeignFunctionInterface, GeneralizedNewtypeDeriving
The core Lua types, including mappings of Lua types to Haskell.
-}
module Foreign.Lua.Api.Types
( GCCONTROL
( GCCONTROL (..)
, LTYPE (..)
, fromLuaType
, toLuaType
Expand Down
5 changes: 5 additions & 0 deletions test/Foreign/Lua/ApiTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module Foreign.Lua.ApiTest (tests) where

import Prelude hiding (compare)

import Control.Monad (forM_)
import Foreign.Lua
import Test.HsLua.Util (luaTestCase, pushLuaExpr)
import Test.QuickCheck (Property, (.&&.))
Expand Down Expand Up @@ -151,6 +152,10 @@ tests = testGroup "Haskell version of the C API"
pushLuaExpr "function () error 'error in error handler' end"
loadstring "error 'this fails'" *> pcall 0 0 (Just (-2))

, testCase "garbage collection" . runLua $ do
-- test that gc can be called with all constructors of type GCCONTROL.
forM_ [GCSTOP .. GCSETSTEPMUL] $ \what -> (gc what 23)

, testGroup "compare"
[ testProperty "identifies strictly smaller values" $ compareWith (<) OpLT
, testProperty "identifies smaller or equal values" $ compareWith (<=) OpLE
Expand Down

0 comments on commit 1e9af42

Please sign in to comment.