| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Test.Hspec.Parsec
Description
Utility functions for testing Parsec parsers with Hspec.
Synopsis
- shouldParse :: (HasCallStack, Show a, Eq a) => Either ParseError a -> a -> Expectation
- shouldFailOn :: (HasCallStack, Show a) => (s -> Either ParseError a) -> s -> Expectation
Documentation
Arguments
| :: (HasCallStack, Show a, Eq a) | |
| => Either ParseError a | Result of parsing as returned by function like |
| -> a | Desired result |
| -> Expectation |
Create an expectation by saying what the result should be.
parseletter"" "x" `shouldParse` 'x'
Arguments
| :: (HasCallStack, Show a) | |
| => (s -> Either ParseError a) | Parser that takes stream and produces result or error message |
| -> s | Input that the parser should fail on |
| -> Expectation |
Check that a parser fails on a given input.
parse(char'x') "" `shouldFailOn` "a"