mirror of
https://github.com/mrkkrp/megaparsec.git
synced 2024-11-24 03:52:07 +03:00
24 lines
512 B
Haskell
24 lines
512 B
Haskell
|
|
module Bugs.Bug6 (main) where
|
|
|
|
import Text.Megaparsec
|
|
import Text.Megaparsec.String
|
|
|
|
import Test.Framework
|
|
import Test.Framework.Providers.HUnit
|
|
import Test.HUnit hiding (Test)
|
|
|
|
import Util
|
|
|
|
main :: Test
|
|
main =
|
|
testCase "Look-ahead preserving error location (#6)" $
|
|
parseErrors variable "return" @?= ["'return' is a reserved keyword"]
|
|
|
|
variable :: Parser String
|
|
variable = do
|
|
x <- lookAhead (some letterChar)
|
|
if x == "return"
|
|
then fail "'return' is a reserved keyword"
|
|
else string x
|