From 8e7b296e820e7513c7846ceeb3fbd87d60bc95f4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 30 Mar 2014 13:12:33 -0400 Subject: split out Property.FIle --- Property.hs | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'Property.hs') diff --git a/Property.hs b/Property.hs index 4aba094f..f00ddfa2 100644 --- a/Property.hs +++ b/Property.hs @@ -127,25 +127,6 @@ cmdProperty' cmd params env = CmdProperty desc cmd params env showp (Param s) = s showp (File s) = s -{- Replaces all the content of a file. -} -fileHasContent :: FilePath -> [Line] -> Property -fileHasContent f newcontent = FileProperty ("replace " ++ f) - f (\_oldcontent -> newcontent) - -{- Ensures that a line is present in a file, adding it to the end if not. -} -lineInFile :: FilePath -> Line -> Property -lineInFile f l = FileProperty (f ++ " contains:" ++ l) f go - where - go ls - | l `elem` ls = ls - | otherwise = ls++[l] - -{- Ensures that a line is not present in a file. - - Note that the file is ensured to exist, so if it doesn't, an empty - - file will be written. -} -lineNotInFile :: FilePath -> Line -> Property -lineNotInFile f l = FileProperty (f ++ " remove: " ++ l) f (filter (/= l)) - {- Makes a perhaps non-idempotent Property be idempotent by using a flag - file to indicate whether it has run before. - Use with caution. -} -- cgit v1.3-2-g0d8e