packages feed

b9-0.5.69.0: src/tests/B9/DiskImagesSpec.hs

module B9.DiskImagesSpec (spec) where
import Test.Hspec
import Test.QuickCheck

import B9.DiskImages

spec :: Spec
spec =
  describe "DiskImages" $ do
    describe "splitToIntermediateSharedImage" $
      do it "puts the original source into the intermediate target" $
             property
                 (\target name ->
                       itImageSource target ==
                       itImageSource
                           (fst (splitToIntermediateSharedImage target name)))
         it "puts the original destination into the export target" $
             property
                 (\target name ->
                       itImageDestination target ==
                       itImageDestination
                           (snd (splitToIntermediateSharedImage target name)))
         it
             "puts the intermediate shared image name into both the intermediate and the export target" $
             property
                 (\target name ->
                       let (intermediateTarget,exportTarget) =
                               splitToIntermediateSharedImage target name
                       in imageDestinationSharedImageName
                              (itImageDestination intermediateTarget) ==
                          imageSourceSharedImageName (itImageSource exportTarget))
    context "inline unit tests"
      unitTests