packages feed

mdoc-0.1.1.0: test/Mdoc/Gen/DescriptionSpec.hs

-- |
--
-- Module      : Mdoc.Gen.DescriptionSpec
-- Copyright   : (c) 2026 Patrick Brisbin
-- License     : AGPL-3
-- Maintainer  : pbrisbin@gmail.com
-- Stability   : experimental
-- Portability : POSIX
module Mdoc.Gen.DescriptionSpec
  ( spec
  ) where

import Mdoc.Prelude

import Mdoc.Gen.Config
import Mdoc.Gen.Described
import Mdoc.Gen.Description
import Mdoc.Gen.Optionality
import Mdoc.Test.Render
import Test.Hspec

spec :: Spec
spec = do
  describe "configLines" $ do
    it "renders with literal examples" $ do
      let config =
            Described
              { item =
                  Config
                    { name = Just "git.push"
                    , schema = Simple "boolean"
                    , exampleLines = Just $ "# disable pushing" :| ["git.push: false"]
                    }
              , optionality = Required
              , multiple = False
              , helpLines = Just $ pure "Push to git remote"
              }

      configLines config
        `shouldRender` [ ".It Cm git.push : Ar boolean"
                       , "Push to git remote"
                       , ".Pp"
                       , "Example:"
                       , ".Bd -literal -offset indent"
                       , "# disable pushing"
                       , "git.push: false"
                       , ".Ed"
                       ]