1
1
mirror of https://github.com/sol/hpack.git synced 2024-10-04 11:47:15 +03:00

Roll DependencySpec.hs into RenderSpec.hs.

This commit is contained in:
quasicomputational 2018-09-09 13:09:39 +01:00
parent e3c27620ef
commit dd9e821d24
3 changed files with 41 additions and 54 deletions

View File

@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: d54d78d25b136d94451fae1d1d792c02ee183adeb4966dfd7d2ce77b18e3b8df
-- hash: 0cbf3a0ac1530c89a2d08e73fdac28c231c675b9e11e339db23af9a6062b20be
name: hpack
version: 0.30.0
@ -164,7 +164,6 @@ test-suite spec
Hpack.HaskellSpec
Hpack.LicenseSpec
Hpack.OptionsSpec
Hpack.Render.DependencySpec
Hpack.Render.DslSpec
Hpack.Render.HintsSpec
Hpack.RenderSpec

View File

@ -1,52 +0,0 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
module Hpack.Render.DependencySpec (spec) where
import Helper
import Hpack.Render
import Hpack.Render.Dsl
import Hpack.Syntax.Dependencies
import Hpack.Syntax.DependencyVersion
spec :: Spec
spec = do
describe "renderDependencies" $ do
it "renders build-depends" $ do
let deps =
[ ("foo", DependencyInfo [] anyVersion)
]
renderDependencies "build-depends" deps `shouldBe`
[ Field "build-depends" $ CommaSeparatedList
[ "foo"
]
, Field "mixins" $ CommaSeparatedList []
]
it "renders build-depends with versions" $ do
let deps =
[ ("foo", DependencyInfo [] (versionRange ">= 2 && < 3"))
]
renderDependencies "build-depends" deps `shouldBe`
[ Field "build-depends" $ CommaSeparatedList
[ "foo >= 2 && < 3"
]
, Field "mixins" $ CommaSeparatedList []
]
it "renders mixins and build-depends for multiple modules" $ do
let deps =
[ ("foo", DependencyInfo ["(Foo as Foo1)"] anyVersion)
, ("bar", DependencyInfo ["hiding (Spam)", "(Spam as Spam1) requires (Mod as Sig)"] anyVersion)
]
renderDependencies "build-depends" deps `shouldBe`
[ Field "build-depends" $ CommaSeparatedList
[ "bar"
, "foo"
]
, Field "mixins" $ CommaSeparatedList
[ "bar hiding (Spam)"
, "bar (Spam as Spam1) requires (Mod as Sig)"
, "foo (Foo as Foo1)"
]
]

View File

@ -345,3 +345,43 @@ spec = do
"name:"
, " ./."
]
describe "renderDependencies" $ do
it "renders build-depends" $ do
let deps_ =
[ ("foo", DependencyInfo [] anyVersion)
]
renderDependencies "build-depends" deps_ `shouldBe`
[ Field "build-depends" $ CommaSeparatedList
[ "foo"
]
, Field "mixins" $ CommaSeparatedList []
]
it "renders build-depends with versions" $ do
let deps_ =
[ ("foo", DependencyInfo [] (versionRange ">= 2 && < 3"))
]
renderDependencies "build-depends" deps_ `shouldBe`
[ Field "build-depends" $ CommaSeparatedList
[ "foo >= 2 && < 3"
]
, Field "mixins" $ CommaSeparatedList []
]
it "renders mixins and build-depends for multiple modules" $ do
let deps_ =
[ ("foo", DependencyInfo ["(Foo as Foo1)"] anyVersion)
, ("bar", DependencyInfo ["hiding (Spam)", "(Spam as Spam1) requires (Mod as Sig)"] anyVersion)
]
renderDependencies "build-depends" deps_ `shouldBe`
[ Field "build-depends" $ CommaSeparatedList
[ "bar"
, "foo"
]
, Field "mixins" $ CommaSeparatedList
[ "bar hiding (Spam)"
, "bar (Spam as Spam1) requires (Mod as Sig)"
, "foo (Foo as Foo1)"
]
]