diff --git a/create_bindings.rb b/create_bindings.rb index 16582cf..b2eed28 100755 --- a/create_bindings.rb +++ b/create_bindings.rb @@ -235,17 +235,28 @@ def fill_cabal(headers) Author: Sakari Jokinen Maintainer: sakariij@gmail.com Build-Type: Simple -Cabal-Version: >=1.2 +Cabal-Version: >=1.10 + +test-suite smoke + default-language: Haskell98 + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: tests + build-depends: + base >=3, + hlibgit2, + process + extra-libraries: git2 library + default-extensions: + ForeignFunctionInterface build-depends: base >= 3 && < 5, - bindings-DSL >= 1.0.7 && < 1.1 + bindings-DSL >= 1.0.9 && < 1.1 exposed-modules: Bindings.Libgit2 #{headers.map{|h| " #{module_name(h)}"}.join("\n")} - extensions: - ForeignFunctionInterface """ } end diff --git a/test/Main.hs b/test/Main.hs deleted file mode 100644 index 984e63e..0000000 --- a/test/Main.hs +++ /dev/null @@ -1,10 +0,0 @@ -module Main where -import Bindings.Libgit2 -import Foreign -import Foreign.C.String - -main = do - alloca $ \ptr -> do - withCString "foobar.git/.git" $ \str -> do - c'git_repository_open ptr str - peek ptr >>= c'git_repository_free \ No newline at end of file diff --git a/tests/Main.hs b/tests/Main.hs new file mode 100644 index 0000000..f9f1326 --- /dev/null +++ b/tests/Main.hs @@ -0,0 +1,15 @@ +module Main where +import Bindings.Libgit2 +import Foreign +import Foreign.C.String +import System.Exit +import Control.Monad(when) +import System.Process(system) + +main = do + alloca $ \ptr -> do + system "git init smoke.git" + withCString "smoke.git/.git" $ \str -> do + r <- c'git_repository_open ptr str + when (r < 0) $ exitWith (ExitFailure 1) + peek ptr >>= c'git_repository_free \ No newline at end of file