File: Main.hs

package info (click to toggle)
haskell-debian 4.0.5-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 472 kB
  • sloc: haskell: 3,914; makefile: 8
file content (42 lines) | stat: -rw-r--r-- 1,425 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module Main where

import Test.HUnit
import System.Exit
import Apt
import Changes
import Control
import Dependencies
import Versions
import Debian.Sources
import Text.PrettyPrint

main :: IO ()
main =
    do (c,st) <- runTestText putTextToShowS (TestList (versionTests ++ [sourcesListTests] ++ dependencyTests ++ changesTests ++ controlTests ++ prettyTests ++ aptTests))
       putStrLn (st "")
       case (failures c) + (errors c) of
         0 -> return ()
         _ -> exitFailure

-- | I was converting from one pretty printing package to another and
-- was unclear how this should work.
prettyTests :: [Test]
prettyTests =
    [ TestCase (assertEqual
                "pretty0"
                (unlines
                 ["Usage: debian-report <old sources.list> <new sources.list>",
                  "",
                  "Find all the packages referenced by the",
                  "second sources.list which trump packages",
                  "found in the first sources.list."])
                (renderStyle (style {lineLength = 60}) (helpText "debian-report"))
               ) ]

helpText :: String -> Doc
helpText progName =
    (text "Usage:" <+> text progName <+> text "<old sources.list>" <+> text "<new sources.list>" $$
     text [] $$
     (fsep $ map text $ words $ "Find all the packages referenced by the second sources.list which trump packages found in the first sources.list.") $$
     text []
    )