File: ConversionsSpec.hs

package info (click to toggle)
haskell-string-conversions 0.4.0.1-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 72 kB
  • sloc: haskell: 176; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 599 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
20
module Data.String.ConversionsSpec where

import           Control.DeepSeq
import           Test.Hspec
import           Test.QuickCheck
import           Test.QuickCheck.Instances ()

import           Data.String.Conversions

spec :: Spec
spec = do
  describe "cs" $ do
    it "allows to convert from String to strict Text" $ do
      property $ \ s ->
        show (s :: String) `shouldBe` show (cs s :: ST)

    context "when converting from strict ByteString to strict Text" $ do
      it "never crashes" $ do
        property $ \ s ->
          deepseq (cs (s :: SBS) :: ST) (return () :: IO ())