htoml-megaparsec-1.0.1.8: test/Text/TomlSpec.hs
{-# LANGUAGE OverloadedStrings #-}
module Text.TomlSpec (hspecTests) where
import Data.List.NonEmpty
import qualified Data.Set as Set
import Test.Hspec
import Text.Megaparsec
import Text.Toml
hspecTests :: Spec
hspecTests = do
describe "parser" $ do
it "should not parse re-assignment of key" $ do
let actual = parseTomlDoc "noSrc" "q={k=42, k=43}\nd=str"
actual `shouldBe` Left (FancyError ((SourcePos "noSrc" (mkPos 1) (mkPos 15)) :| []) (Set.fromList [(ErrorFail "Cannot redefine key k")]))