packages feed

mdoc-0.3.2.0: test/Mdoc/Data/ConfigSpec.hs

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

import Mdoc.Prelude

import Mdoc.Data.Config
import Mdoc.Data.Described
import Mdoc.Data.Optionality
import Mdoc.Syntax
import Mdoc.Test.Render
import Test.Hspec

spec :: Spec
spec = do
  it "renders with literal examples" $ do
    let config =
          Described
            { item =
                Config
                  { name = Just "git.push"
                  , schema = Simple "boolean"
                  }
            , optionality = Required
            , multiple = False
            , help = Just $ Mdoc [TextLine "Push to git remote"]
            , example =
                textToMdoc
                  $ mconcat
                    [ "# disable pushing\n"
                    , "git:\n"
                    , "  push: false\n"
                    , "\n"
                    ]
            }

    renderPlain (prettyDescribed config)
      `shouldBe` mconcat
        [ ".It Cm git.push : Ar boolean\n"
        , "Push to git remote"
        ]