File: Spec.hs

package info (click to toggle)
haskell-stringbuilder 0.5.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 60 kB
  • sloc: haskell: 57; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 577 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{-# LANGUAGE OverloadedStrings #-}
module Main (main, spec) where

import           Test.Hspec
import           Test.QuickCheck

import           Data.String
import           Data.String.Builder

main :: IO ()
main = hspec spec

spec :: Spec
spec = do
  describe "build" $ do
    it "can be used to construct multi-line string literals in a monadic way" $ do
      build $ do
        "foo"
        "bar"
        "baz"
      `shouldBe` "foo\nbar\nbaz\n"

    it "works for arbitrary input" $ do
      property $
        \l -> (build . sequence_ . map fromString) l == unlines l