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"
]
|