megaparsec-tests 9.6.1 → 9.7.0
raw patch · 3 files changed
+63/−7 lines, 3 filesdep ~QuickCheckdep ~containersdep ~megaparsecPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, containers, megaparsec
API changes (from Hackage documentation)
- Test.Hspec.Megaparsec.AdHoc: instance Test.QuickCheck.Arbitrary.Arbitrary Data.ByteString.Internal.ByteString
- Test.Hspec.Megaparsec.AdHoc: instance Test.QuickCheck.Arbitrary.Arbitrary Data.Void.Void
+ Test.Hspec.Megaparsec.AdHoc: instance Test.QuickCheck.Arbitrary.Arbitrary Data.ByteString.Internal.Type.ByteString
+ Test.Hspec.Megaparsec.AdHoc: instance Test.QuickCheck.Arbitrary.Arbitrary GHC.Base.Void
Files
- megaparsec-tests.cabal +8/−7
- tests/Text/Megaparsec/ErrorSpec.hs +35/−0
- tests/Text/Megaparsec/UnicodeSpec.hs +20/−0
megaparsec-tests.cabal view
@@ -1,11 +1,11 @@ cabal-version: 2.4 name: megaparsec-tests-version: 9.6.1+version: 9.7.0 license: BSD-2-Clause license-file: LICENSE.md maintainer: Mark Karpov <markkarpov92@gmail.com> author: Megaparsec contributors-tested-with: ghc ==9.4.7 ghc ==9.6.3 ghc ==9.8.1+tested-with: ghc ==9.6.3 ghc ==9.8.2 ghc ==9.10.1 homepage: https://github.com/mrkkrp/megaparsec bug-reports: https://github.com/mrkkrp/megaparsec/issues synopsis: Test utilities and the test suite of Megaparsec@@ -24,13 +24,13 @@ hs-source-dirs: src default-language: Haskell2010 build-depends:- QuickCheck >=2.10 && <2.15,+ QuickCheck >=2.10 && <2.16, base >=4.15 && <5, bytestring >=0.2 && <0.13, containers >=0.5 && <0.8, hspec >=2 && <3, hspec-megaparsec >=2 && <3,- megaparsec ==9.6.1,+ megaparsec ==9.7.0, mtl >=2.2.2 && <3, text >=0.2 && <2.2, transformers >=0.4 && <0.7@@ -58,18 +58,19 @@ Text.Megaparsec.ErrorSpec Text.Megaparsec.PosSpec Text.Megaparsec.StreamSpec+ Text.Megaparsec.UnicodeSpec Text.MegaparsecSpec default-language: Haskell2010 build-depends:- QuickCheck >=2.10 && <2.15,+ QuickCheck >=2.10 && <2.16, base >=4.15 && <5, bytestring >=0.2 && <0.13, case-insensitive >=1.2 && <1.3, containers >=0.5 && <0.8, hspec >=2 && <3, hspec-megaparsec >=2 && <3,- megaparsec ==9.6.1,+ megaparsec ==9.7.0, megaparsec-tests, mtl >=2.2.2 && <3, scientific >=0.3.1 && <0.4,@@ -80,7 +81,7 @@ if flag(dev) ghc-options: -Wall -Werror -Wredundant-constraints -Wpartial-fields- -Wunused-packages+ -Wunused-packages -Wno-unused-imports else ghc-options: -O2 -Wall
tests/Text/Megaparsec/ErrorSpec.hs view
@@ -199,6 +199,41 @@ ++ replicate errColumn ' ' ++ "^\nunexpected 'b'\nexpecting 'x'\n" )+ context "in the presence of wide characters" $ do+ it "calculates column positions correctly" $ do+ let s = "구구 이면" :: String+ pe = err 2 (ulabel "space" <> etok '이') :: PE+ bundle =+ ParseErrorBundle+ { bundleErrors = pe :| [],+ bundlePosState =+ PosState+ { pstateInput = s,+ pstateOffset = 0,+ pstateSourcePos = initialPos "",+ pstateTabWidth = defaultTabWidth,+ pstateLinePrefix = ""+ }+ }+ errorBundlePretty bundle+ `shouldBe` "1:5:\n |\n1 | 구구 이면\n | ^\nunexpected space\nexpecting '이'\n"+ it "uses continuous highlighting" $ do+ let s = "구구 이면" :: String+ pe = err 3 (utok '이' <> etok '구') :: PE+ bundle =+ ParseErrorBundle+ { bundleErrors = pe :| [],+ bundlePosState =+ PosState+ { pstateInput = s,+ pstateOffset = 0,+ pstateSourcePos = initialPos "",+ pstateTabWidth = defaultTabWidth,+ pstateLinePrefix = ""+ }+ }+ errorBundlePretty bundle+ `shouldBe` "1:6:\n |\n1 | 구구 이면\n | ^^\nunexpected '이'\nexpecting '구'\n" it "displays multi-error bundle correctly" $ do let s = "something\ngood\n" :: String pe0 = err 2 (utok 'm' <> etok 'x') :: PE
+ tests/Text/Megaparsec/UnicodeSpec.hs view
@@ -0,0 +1,20 @@+module Text.Megaparsec.UnicodeSpec (spec) where++import Test.Hspec+import qualified Text.Megaparsec.Unicode as Unicode++spec :: Spec+spec = do+ describe "stringLength" $+ it "computes correct length in the presense of wide chars" $+ Unicode.stringLength "123 구구 이면" `shouldBe` 13+ describe "charLength" $ do+ it "returns 1 for non-wide chars" $+ Unicode.charLength 'a' `shouldBe` 1+ it "returns 2 for wide chars" $+ Unicode.charLength '구' `shouldBe` 2+ describe "isWideChar" $ do+ it "returns False for non-wide chars" $+ Unicode.isWideChar 'a' `shouldBe` False+ it "returns True for wide chars" $+ Unicode.isWideChar '구' `shouldBe` True