File: ModifierSpec.hs

package info (click to toggle)
haskell-getopt-generics 0.13.1.0-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 260 kB
  • sloc: haskell: 1,644; makefile: 6
file content (34 lines) | stat: -rw-r--r-- 716 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{-# LANGUAGE DeriveGeneric #-}

module WithCli.ModifierSpec where

import           Test.Hspec

import           Util
import           WithCli
import           WithCli.Modifier

spec :: Spec
spec = do
  describe "insertWith" $ do
    it "combines existing values with the given function" $ do
      insertWith (++) (1 :: Integer) "bar" [(1, "foo")]
        `shouldBe` [(1, "foobar")]

  describe "getVersion" $ do
    it "returns the version" $ do
      let modifiers = unsafeModifiers [AddVersionFlag "1.0.0"]
      getVersion modifiers `shouldBe` Just "1.0.0"

data Foo
  = Foo {
    bar :: String
  }
  deriving (Generic)

data Overlap
  = Overlap {
    foo :: String,
    fooo :: String
  }
  deriving (Generic)