File: UtilSpec.hs

package info (click to toggle)
haskell-doctest-parallel 0.3.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 652 kB
  • sloc: haskell: 3,241; makefile: 6; ansic: 4
file content (21 lines) | stat: -rw-r--r-- 575 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module UtilSpec (main, spec) where

import           Test.Hspec

import           Test.DocTest.Internal.Util

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "convertDosLineEndings" $ do
    it "converts CRLF to LF" $ do
      convertDosLineEndings "foo\r\nbar\r\nbaz" `shouldBe` "foo\nbar\nbaz"

    it "strips a trailing CR" $ do
      convertDosLineEndings "foo\r" `shouldBe` "foo"

  describe "takeWhileEnd" $ do
    it "returns the longest suffix of elements that satisfy a given predicate" $ do
      takeWhileEnd (/= ' ') "foo bar" `shouldBe` "bar"