megaparsec-tests 9.7.1 → 9.8.0
raw patch · 6 files changed
+37/−5 lines, 6 filesdep ~basedep ~megaparsecPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, megaparsec
API changes (from Hackage documentation)
- Test.Hspec.Megaparsec.AdHoc: instance Test.QuickCheck.Arbitrary.Arbitrary GHC.Base.Void
+ Test.Hspec.Megaparsec.AdHoc: instance Test.QuickCheck.Arbitrary.Arbitrary GHC.Internal.Base.Void
Files
- megaparsec-tests.cabal +4/−4
- tests/Text/Megaparsec/Byte/LexerSpec.hs +7/−0
- tests/Text/Megaparsec/Char/LexerSpec.hs +7/−0
- tests/Text/Megaparsec/ErrorSpec.hs +5/−0
- tests/Text/Megaparsec/StreamSpec.hs +0/−1
- tests/Text/MegaparsecSpec.hs +14/−0
megaparsec-tests.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: megaparsec-tests-version: 9.7.1+version: 9.8.0 license: BSD-2-Clause license-file: LICENSE.md maintainer: Mark Karpov <markkarpov92@gmail.com>@@ -30,7 +30,7 @@ containers >=0.5 && <0.9, hspec >=2 && <3, hspec-megaparsec >=2 && <3,- megaparsec ==9.7.1,+ megaparsec ==9.8.0, mtl >=2.2.2 && <3, text >=0.2 && <2.2, transformers >=0.4 && <0.7@@ -70,7 +70,7 @@ containers >=0.5 && <0.9, hspec >=2 && <3, hspec-megaparsec >=2 && <3,- megaparsec ==9.7.1,+ megaparsec ==9.8.0, megaparsec-tests, mtl >=2.2.2 && <3, scientific >=0.3.1 && <0.4,@@ -81,7 +81,7 @@ if flag(dev) ghc-options: -Wall -Werror -Wredundant-constraints -Wpartial-fields- -Wunused-packages -Wno-unused-imports+ -Wunused-packages else ghc-options: -O2 -Wall
tests/Text/Megaparsec/Byte/LexerSpec.hs view
@@ -64,6 +64,13 @@ s = B8.pack (showInt n "") prs p s `shouldParse` n prs' p s `succeedsLeaving` ""+ context "when parsing Float values (issue #479)" $+ it "maintains precision without accumulated floating-point errors" $ do+ let p = decimal :: Parser Float+ s = "655361200000"+ expected = fromIntegral (655361200000 :: Integer) :: Float+ prs p s `shouldParse` expected+ prs' p s `succeedsLeaving` "" context "when stream does not begin with decimal digits" $ it "signals correct parse error" $ property $ \a as ->
tests/Text/Megaparsec/Char/LexerSpec.hs view
@@ -307,6 +307,13 @@ s = showInt n "" prs p s `shouldParse` n prs' p s `succeedsLeaving` ""+ context "when parsing Float values (issue #479)" $+ it "maintains precision without accumulated floating-point errors" $ do+ let p = decimal :: Parser Float+ s = "655361200000"+ expected = fromIntegral (655361200000 :: Integer) :: Float+ prs p s `shouldParse` expected+ prs' p s `succeedsLeaving` "" context "when stream does not begin with decimal digits" $ it "signals correct parse error" $ property $ \a as ->
tests/Text/Megaparsec/ErrorSpec.hs view
@@ -101,6 +101,11 @@ pe = err 1 (utok 's' <> etok 'x') :: PE mkBundlePE s pe `shouldBe` "1:9:\n |\n1 | something\n | ^\nunexpected 's'\nexpecting 'x'\n"+ it "shows offending line in the presence of zero-width characters correctly (issue #572)" $ do+ let s = "abc\SOHdef\SOHghi" :: String+ pe = err 4 (utok 'd' <> etok 'x') :: PE+ mkBundlePE s pe+ `shouldBe` "1:4:\n |\n1 | abc\SOHdef\SOHghi\n | ^\nunexpected 'd'\nexpecting 'x'\n" it "uses continuous highlighting properly (trivial)" $ do let s = "\tfoobar" :: String pe = err 1 (utoks "foo" <> utoks "rar") :: PE
tests/Text/Megaparsec/StreamSpec.hs view
@@ -8,7 +8,6 @@ import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as BL import Data.Char (chr, isControl, isLetter, isSpace)-import Data.List (foldl') import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NE import Data.Proxy
tests/Text/MegaparsecSpec.hs view
@@ -214,6 +214,20 @@ property $ \a b -> do let p = char a <|> (char b *> char a) prs p "" `shouldFailWith` err 0 (ueof <> etok a <> etok b)+ context "when testing associativity with try" $ do+ let a = try (char 'a' >> empty)+ b = void (char 'b')+ c = pure ()+ pLeftAssociative = ((a <|> b) <|> c) >> char 'd'+ pRightAssociative = (a <|> (b <|> c)) >> char 'd'+ e = err 0 (utok 'a' <> etok 'd' <> etok 'b')+ s = "aaa"+ context "left associative" $+ it "fails with the right error" $+ prs pLeftAssociative s `shouldFailWith` e+ context "right associative" $+ it "fails with the right error" $+ prs pRightAssociative s `shouldFailWith` e it "associativity of fold over alternatives should not matter" $ do let p = asum [empty, string ">>>", empty, return "foo"] <?> "bar" p' = bsum [empty, string ">>>", empty, return "foo"] <?> "bar"