File: DefinitionSpec.hs

package info (click to toggle)
haskell-hspec-core 2.11.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 656 kB
  • sloc: haskell: 8,945; makefile: 5
file content (22 lines) | stat: -rw-r--r-- 605 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Test.Hspec.Core.Config.DefinitionSpec (spec) where

import           Prelude ()
import           Helper

import           Test.Hspec.Core.Config.Definition

spec :: Spec
spec = do
  describe "splitOn" $ do
    it "splits a string" $ do
      splitOn ',' "foo,bar,baz" `shouldBe` ["foo", "bar", "baz"]

    it "splits *arbitrary* strings" $ property $ do
      let
        string :: Gen String
        string = arbitrary `suchThat` p

        p :: String -> Bool
        p = (&&) <$> not . null <*> all (/= ',')

      forAll (listOf string) $ \ xs -> splitOn ',' (intercalate "," xs) `shouldBe` xs