Add missing cabal fields. v0.0.1
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 20 Aug 2012 20:22:35 +0000 (16:22 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 20 Aug 2012 20:22:35 +0000 (16:22 -0400)
Integrate the test suite with cabal.

lwn-epub.cabal
makefile
test/TestSuite.hs

index 01206c15660f37f30bf0fe7bc7ac738d12e86120..c18f60f4827be2c3d28d1dd99d1d522566eb06a8 100644 (file)
@@ -3,9 +3,19 @@ version:        0.0.1
 cabal-version:  >= 1.8
 author:         Michael Orlitzky
 maintainer:    Michael Orlitzky <michael@orlitzky.com>
+license:        GPL-3
+license-file:   doc/LICENSE
+homepage:       http://michael.orlitzky.com/code/lwn-epub.php
+bug-reports:    mailto:michael@orlitzky.com
+build-type:     Simple
+category: Text
 synopsis:
   Convert issues of LWN (lwn.net) to EPUB format.
-build-type:     Simple
+description:
+  A command-line utility that downloads an LWN article (or issue), cleans it
+  up, and writes it to EPUB with a stylesheet that looks decent on the Kindle.
+  It can use account credentials to log in and access the current edition.
+data-files: doc/README
 
 executable lwn-epub
   build-depends:
@@ -19,7 +29,6 @@ executable lwn-epub
     HandsomeSoup            == 0.3.*,
     http-conduit            == 1.6.*,
     http-types              == 0.7.*,
-    HUnit                   == 1.2.*,
     hxt                     == 9.*,
     MissingH                == 1.1.*,
     network                 == 2.3.*,
@@ -27,10 +36,12 @@ executable lwn-epub
     parallel-io             == 0.3.*,
     regex-posix             == 0.95.*,
     temporary               == 1.*,
-    test-framework          == 0.6.*,
-    test-framework-hunit    == 0.2.*,
     time                    == 1.*,
-    utf8-string             == 0.3.*
+    utf8-string             == 0.3.*,
+    -- Additional test dependencies.
+    HUnit                   == 1.2.*,
+    test-framework          == 0.6.*,
+    test-framework-hunit    == 0.2.*
 
   main-is:
     Main.hs
@@ -49,11 +60,52 @@ executable lwn-epub
     -fwarn-incomplete-record-updates
     -fwarn-monomorphism-restriction
     -fwarn-unused-do-bind
-    -funbox-strict-fields
-    -fexcess-precision
-    -fno-spec-constr-count
     -rtsopts
     -threaded
     -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.*,
+    bytestring              == 0.9.*,
+    cmdargs                 == 0.9.*,
+    ConfigFile              == 1.*,
+    containers              == 0.*,
+    directory               == 1.1.*,
+    filepath                == 1.3.*,
+    HandsomeSoup            == 0.3.*,
+    http-conduit            == 1.6.*,
+    http-types              == 0.7.*,
+    hxt                     == 9.*,
+    MissingH                == 1.1.*,
+    network                 == 2.3.*,
+    pandoc                  == 1.9.*,
+    parallel-io             == 0.3.*,
+    regex-posix             == 0.95.*,
+    temporary               == 1.*,
+    time                    == 1.*,
+    utf8-string             == 0.3.*,
+    -- Additional test dependencies.
+    HUnit                   == 1.2.*,
+    test-framework          == 0.6.*,
+    test-framework-hunit    == 0.2.*
+
+  -- It's not entirely clear to me why I have to reproduce all of this.
+  ghc-options:
+    -rtsopts
+    -threaded
+    -O2
+    -optc-O3
+    -optc-march=native
+
+
+source-repository head
+  type: git
+  location: http://michael.orlitzky.com/git/lwn-epub.git
+  branch: master
index a848bcc9e227bed5f264de15f287829d98eda6bc..9a1337225a32b22b7e4f2fe014495b56271c2c45 100644 (file)
--- a/makefile
+++ b/makefile
@@ -4,6 +4,7 @@
 # it for make.
 PN   = $(shell grep 'name:' *.cabal | awk '{ print $$2 }')
 BIN  = dist/build/$(PN)/$(PN)
+TESTSUITE_BIN = dist/build/testsuite/testsuite
 SRCS = $(shell find src/ -name '*.hs')
 
 $(BIN): $(SRCS)
@@ -11,6 +12,10 @@ $(BIN): $(SRCS)
        runghc Setup.hs configure --user --flags=${FLAGS}
        runghc Setup.hs build
 
+$(TESTSUITE_BIN): src/*.hs test/TestSuite.hs
+       runghc Setup.hs configure --user --flags=${FLAGS} --enable-tests
+       runghc Setup.hs build
+
 clean:
        runghc Setup.hs clean
        rm -f dist/
@@ -27,8 +32,5 @@ doc: src_html
                                --executables \
                                --hyperlink-source
 
-dist/build/autogen: $(BIN)
-
-
-test: dist/build/autogen
-       runghc -i"src" -i"dist/build/autogen" test/TestSuite.hs
+test: $(BIN) $(TESTSUITE_BIN)
+       runghc Setup.hs test
index adbb203f65e9fada4a99f1f7583eddfacd70f7fd..ca6c0e83e42c409f2d780d3f98620355d6280393 100644 (file)
@@ -1,4 +1,4 @@
-module TestSuite
+module Main
 where
 
 import Test.Framework (