mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-11-23 03:39:35 +03:00
28 lines
871 B
Haskell
28 lines
871 B
Haskell
module DerivationSpec where
|
|
|
|
import Test.Hspec (Spec, describe)
|
|
import Test.Hspec.QuickCheck (xprop)
|
|
import Test.Hspec.Nix (roundtrips)
|
|
|
|
import System.Nix.Arbitrary ()
|
|
import System.Nix.Derivation (parseDerivation, buildDerivation)
|
|
|
|
import qualified Data.Attoparsec.Text
|
|
import qualified Data.Text.Lazy
|
|
import qualified Data.Text.Lazy.Builder
|
|
|
|
-- TODO(srk): this won't roundtrip as Arbitrary Text
|
|
-- contains wild stuff like control characters and UTF8 sequences.
|
|
-- Either fix in nix-derivation or use wrapper type
|
|
-- (but we use Nix.Derivation.textParser so we need Text for now)
|
|
spec :: Spec
|
|
spec = do
|
|
describe "Derivation" $ do
|
|
xprop "roundtrips via Text" $ \sd ->
|
|
roundtrips
|
|
( Data.Text.Lazy.toStrict
|
|
. Data.Text.Lazy.Builder.toLazyText
|
|
. buildDerivation sd
|
|
)
|
|
(Data.Attoparsec.Text.parseOnly (parseDerivation sd))
|