File: UtilSpec.hs

package info (click to toggle)
haskell-hspec-core 2.11.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 656 kB
  • sloc: haskell: 8,945; makefile: 5
file content (31 lines) | stat: -rw-r--r-- 987 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
module GetOpt.Declarative.UtilSpec (spec) where

import           Prelude ()
import           Helper

import           System.Console.GetOpt

import           GetOpt.Declarative.Util

spec :: Spec
spec = do
  describe "mkUsageInfo" $ do
    it "restricts output size to 80 characters" $ do
      let options = [
              Option "" ["color"] (NoArg ()) (unwords $ replicate 3 "some very long and verbose help text")
            ]
      mkUsageInfo "" options `shouldBe` unlines [
          ""
        , "    --color  some very long and verbose help text some very long and verbose"
        , "             help text some very long and verbose help text"
        ]

    it "condenses help for --no-options" $ do
      let options = [
              Option "" ["color"] (NoArg ()) "some help"
            , Option "" ["no-color"] (NoArg ()) "some other help"
            ]
      mkUsageInfo "" options `shouldBe` unlines [
          ""
        , "    --[no-]color  some help"
        ]