{-# LANGUAGE OverloadedStrings #-}
module Text.TomlSpec (hspecTests) where
import Data.List.NonEmpty
import qualified Data.Set as Set
import Data.Text (Text)
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}"
actual `shouldBe` Left (FancyError ((SourcePos "noSrc" (mkPos 1) (mkPos 15)) :| []) (Set.fromList [(ErrorFail "Cannot redefine key k")]))