Skip to content
Snippets Groups Projects
Spec.hs 1.02 KiB
{-# LANGUAGE OverloadedStrings #-}
module Main ( main ) where

import           Data.ByteString           (fromStrict)
import           Data.Text.Encoding        (encodeUtf8)
import           Dhall                     (auto, embed, inject, input)
import           Dhall.Pretty              (layout, prettyExpr)
import           Horizon.Spec              (PackageSet)
import           Prettyprinter.Render.Text (renderStrict)
import           Test.Tasty                (TestTree, defaultMain, testGroup)
import           Test.Tasty.Golden         (goldenVsString)

main :: IO ()
main = defaultMain tests

tests :: TestTree
tests = testGroup "Tests" [ samplePackageSet ]

samplePackageSet :: TestTree
samplePackageSet = goldenVsString "sample package set" "./test/data/sample-package-set/output.golden" $ do
                    (x :: PackageSet) <- input auto "./test/data/sample-package-set/input.dhall"
                    let doc = prettyExpr $ embed inject x
                    pure $ fromStrict $ encodeUtf8 $ renderStrict (layout doc)