mirror of
https://github.com/gren-lang/compiler.git
synced 2024-08-16 20:10:23 +03:00
Backfill simple Parse.Space test
This commit is contained in:
parent
eff5b1c6b1
commit
1c2569ac3f
@ -231,6 +231,12 @@ Test-Suite gren-tests
|
||||
Main-Is:
|
||||
Spec.hs
|
||||
|
||||
other-modules:
|
||||
Helpers.Instances
|
||||
|
||||
-- tests
|
||||
Parse.SpaceSpec
|
||||
|
||||
Build-Depends:
|
||||
hspec >= 2.7.10 && < 3
|
||||
|
||||
|
19
tests/Helpers/Instances.hs
Normal file
19
tests/Helpers/Instances.hs
Normal file
@ -0,0 +1,19 @@
|
||||
{-# LANGUAGE StandaloneDeriving #-}
|
||||
{-# OPTIONS_GHC -Wno-orphans #-}
|
||||
|
||||
module Helpers.Instances where
|
||||
|
||||
import qualified AST.Source as Src
|
||||
import qualified Data.Utf8 as Utf8
|
||||
import qualified Reporting.Error.Syntax as E
|
||||
|
||||
instance Show (Utf8.Utf8 a) where
|
||||
show utf8 = "\"" <> Utf8.toChars utf8 <> "\""
|
||||
|
||||
deriving instance Eq Src.Comment
|
||||
|
||||
deriving instance Show Src.Comment
|
||||
|
||||
deriving instance Eq E.Space
|
||||
|
||||
deriving instance Show E.Space
|
16
tests/Parse/SpaceSpec.hs
Normal file
16
tests/Parse/SpaceSpec.hs
Normal file
@ -0,0 +1,16 @@
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
|
||||
module Parse.SpaceSpec where
|
||||
|
||||
import Helpers.Instances ()
|
||||
import qualified Parse.Primitives as P
|
||||
import qualified Parse.Space as Space
|
||||
import Test.Hspec
|
||||
|
||||
spec :: Spec
|
||||
spec = do
|
||||
describe "chomp" $ do
|
||||
let parseChomp = P.fromByteString (Space.chomp (\e _ _ -> Just e)) (\_ _ -> Nothing)
|
||||
|
||||
it "parses spaces and newlines" $
|
||||
parseChomp " \n " `shouldBe` (Right [])
|
Loading…
Reference in New Issue
Block a user