]> gitweb.michael.orlitzky.com - spline3.git/commitdiff
Remove the test-framework-doctest dependency.
authorMichael Orlitzky <michael@orlitzky.com>
Sun, 19 Aug 2012 18:01:00 +0000 (14:01 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sun, 19 Aug 2012 18:01:00 +0000 (14:01 -0400)
Split the doctests out into a new file, Doctests.hs.
Integrate all tests with cabal.

makefile
spline3.cabal
test/Doctests.hs [new file with mode: 0644]
test/TestSuite.hs

index 236c495dc7f61abb94bd803e481972f436b1e6be..78bf454cac68b6c2bec8f11b8863a224c8f9cd75 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,10 +1,22 @@
+BIN           = dist/build/spline3/spline3
+DOCTESTS_BIN  = dist/build/doctests/doctests
+TESTSUITE_BIN = dist/build/testsuite/testsuite
+
 .PHONY : test publish_doc doc src_html hlint
 
-spline3: src/*.hs
+$(BIN): src/*.hs
        runghc Setup.hs clean
        runghc Setup.hs configure --user --flags=${FLAGS}
        runghc Setup.hs build
 
+$(DOCTESTS_BIN): src/*.hs test/Doctests.hs
+       runghc Setup.hs configure --user --flags=${FLAGS} --enable-tests
+       runghc Setup.hs build
+
+$(TESTSUITE_BIN): src/*.hs test/TestSuite.hs
+       runghc Setup.hs configure --user --flags=${FLAGS} --enable-tests
+       runghc Setup.hs build
+
 llvm: src/*.hs
        FLAGS="llvm" make
 
@@ -21,8 +33,8 @@ clean:
        rm -f *.prof
        rm -rf .hpc
 
-test:
-       runghc -i"src" test/TestSuite.hs
+test: $(BIN) $(DOCTESTS_BIN) $(TESTSUITE_BIN)
+       runghc Setup.hs test
 
 src_html:
        util/hscolour_srcs
index e65f0cc7975745521d9898b114b3a8cd847ed493..a1be0aa2db1d429856f997cfff92864bb32a926f 100644 (file)
@@ -16,21 +16,21 @@ flag LLVM
   description: Build with LLVM
   default:     False
 
+
 executable spline3
   build-depends:
     base                        == 4.5.*,
-    doctest                     == 0.7.*,
     filepath                    == 1.*,
-    HUnit                       == 1.2.*,
-    QuickCheck                  == 2.*,
     repa                        == 3.2.*,
     repa-algorithms             == 3.2.*,
     repa-io                     == 3.2.*,
+    vector                      == 0.9.*,
+    -- Additional test dependencies.
+    HUnit                       == 1.2.*,
+    QuickCheck                  == 2.*,
     test-framework              == 0.6.*,
-    test-framework-doctest      == 0.2.*,
     test-framework-hunit        == 0.2.*,
-    test-framework-quickcheck2  == 0.2.*,
-    vector                      == 0.9.*
+    test-framework-quickcheck2  == 0.2.*
 
   main-is:
     Main.hs
@@ -74,3 +74,76 @@ executable spline3
     -prof
     -auto-all
     -caf-all
+
+
+test-suite doctests
+  type: exitcode-stdio-1.0
+  hs-source-dirs: test
+  main-is: Doctests.hs
+  build-depends:
+    base                        == 4.5.*,
+    -- Additional test dependencies.
+    doctest                     == 0.7.*
+
+  -- It's not entirely clear to me why I have to reproduce all of this.
+  ghc-options:
+    -rtsopts
+    -threaded
+    -funbox-strict-fields
+    -fexcess-precision
+    -fno-spec-constr-count
+
+  if flag(llvm)
+    ghc-options:
+      -fllvm
+      -optlo-O3
+      -optlc-O3
+  else
+    ghc-options:
+      -O2
+      -optc-O3
+      -optc-march=native
+
+
+test-suite testsuite
+  type: exitcode-stdio-1.0
+  hs-source-dirs: src test
+  main-is: TestSuite.hs
+  build-depends:
+    base                        == 4.5.*,
+    filepath                    == 1.*,
+    repa                        == 3.2.*,
+    repa-algorithms             == 3.2.*,
+    repa-io                     == 3.2.*,
+    vector                      == 0.9.*,
+    -- Additional test dependencies.
+    HUnit                       == 1.2.*,
+    QuickCheck                  == 2.*,
+    test-framework              == 0.6.*,
+    test-framework-hunit        == 0.2.*,
+    test-framework-quickcheck2  == 0.2.*
+
+  -- It's not entirely clear to me why I have to reproduce all of this.
+  ghc-options:
+    -rtsopts
+    -threaded
+    -funbox-strict-fields
+    -fexcess-precision
+    -fno-spec-constr-count
+
+  if flag(llvm)
+    ghc-options:
+      -fllvm
+      -optlo-O3
+      -optlc-O3
+  else
+    ghc-options:
+      -O2
+      -optc-O3
+      -optc-march=native
+
+
+source-repository head
+  type: git
+  location: http://michael.orlitzky.com/git/spline3.git
+  branch: master
diff --git a/test/Doctests.hs b/test/Doctests.hs
new file mode 100644 (file)
index 0000000..34b7b0c
--- /dev/null
@@ -0,0 +1,7 @@
+module Main
+where
+
+import Test.DocTest
+
+main :: IO ()
+main = doctest ["--optghc=-isrc", "src/Everything.hs"]
index 0491f56dfe87babdb1b7f914e5da9e0d5e7a5cb0..4a0b405695247a6d9d440cd9a87f3e1439d350ba 100644 (file)
@@ -1,4 +1,4 @@
-module TestSuite
+module Main
 where
 
 import Data.Monoid (mempty)
@@ -13,7 +13,6 @@ import Test.Framework (
 import Test.Framework.Options
 import Test.Framework.Runners.Options
 import Test.Framework.Providers.API (TestName)
-import Test.Framework.Providers.DocTest
 import Test.Framework.Providers.HUnit (testCase)
 import Test.Framework.Providers.QuickCheck2 (testProperty)
 import Test.HUnit
@@ -28,8 +27,6 @@ import Tetrahedron (tetrahedron_tests, tetrahedron_properties)
 
 main :: IO ()
 main = do
-  dt <- docTest ["src/Everything.hs"] ["-isrc"]
-
   let empty_test_opts = mempty :: TestOptions
   let my_test_opts = empty_test_opts {
     topt_maximum_generated_tests = Just 500
@@ -40,7 +37,7 @@ main = do
     ropt_test_options = Just my_test_opts
   }
 
-  defaultMainWithOpts ([dt] ++ tests) my_runner_opts
+  defaultMainWithOpts tests my_runner_opts
 
 
 -- | Defined so that my test names fit on one line.