File: Spec.hs

package info (click to toggle)
haskell-trifecta 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 256 kB
  • sloc: haskell: 1,793; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 897 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Main where

import qualified RFC2616

import           Control.Monad.IO.Class (liftIO)
import           Test.Hspec
import           Text.Trifecta

-- Just [(Request {requestMethod = "GET", requestUri = "http://slashdot.org/", requestProtocol = "1.1"},[Header {headerName = "foo", headerValue = ["this is a test"]}]),(Request {requestMethod = "GET", requestUri = "http://slashdot.org/", requestProtocol = "1.0"},[Header {headerName = "foo", headerValue = ["of the emergency broadcast system"]}])]

main :: IO ()
main = hspec $ do
  describe "RFC2616.hs should be able to parse RFC2616" $ do
    it "parses the RFC2616.txt file successfully" $ do
      -- result :: Maybe [(RFC2616.Request, [RFC2616.Header])]
      -- Tests are intended to be run from the top level.
      result <- liftIO $ parseFromFile RFC2616.requests "RFC2616.txt"
      print result
      result `shouldNotBe` Nothing