denominate 0.4.2 → 0.5.0
raw patch · 5 files changed
+90/−64 lines, 5 filesdep ~basesetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- Makefile +8/−4
- Setup.hs +1/−1
- TestRunner.hs +76/−0
- denominate.cabal +5/−5
- quickcheck +0/−54
Makefile view
@@ -5,16 +5,20 @@ runhaskell Setup.hs clean configure: Setup.hs denominate.cabal *.hs- runhaskell Setup.hs configure --user --prefix=${HOME}+ runhaskell Setup.hs configure --user --prefix=${HOME} \+ --docdir=dist/doc \+ --haddock-options="-v \+ --source-module=http://protempore.net/denominate/doc/src/%M.hs" build: configure runhaskell Setup.hs build haddock: configure build- runhaskell Setup.hs haddock- find dist/doc/html -name '*.html' -exec \- sed -i -r 's_/usr/share/doc/ghc-[^/]+/html/libraries/_http://www.haskell.org/ghc/docs/latest/html/libraries/_g' {} \;+ runhaskell Setup.hs haddock --hyperlink-source install: configure build runhaskell Setup.hs install++test:+ runhaskell Setup.hs test
Setup.hs view
@@ -10,4 +10,4 @@ test :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO () test _ _ _ _ = runCommand commandStr >>= waitForProcess >> return ()- where commandStr = "./quickcheck +names System/Denominate_Test.hs"+ where commandStr = "runhaskell TestRunner +names System/Denominate_Test.hs"
+ TestRunner.hs view
@@ -0,0 +1,76 @@+module TestRunner where++-- $Id: quickcheck,v 1.4 2003/01/08 15:09:22 shae Exp $ +-- This file defines a command+-- quickCheck <options> <files>+-- which invokes quickCheck on all properties defined in the files given as+-- arguments, by generating an input script for hugs and then invoking it.+-- quickCheck recognises the options+-- +names print the name of each property before checking it+-- -names do not print property names (the default)+-- Other options (beginning with + or -) are passed unchanged to hugs.+--+-- Change the first line of this file to the location of runhugs on your +-- system.+-- Make the file executable.+--+-- TODO:+-- someone on #haskell asked about supporting QC tests inside LaTeX, ex. \{begin} \{end}, how?+-- add a verbosity switch that uses verboseCheck instead of quickCheck++import System+import Data.List++-- CS added for getting compiler version for base-? hackery+import System.Info+import Data.Version+import System.Process+import System.IO++main :: IO ()+main = do as<-getArgs+ sequence_ (map (process (filter isOption as)) + (filter (not.isOption) as))++-- ugly hack for .lhs files, is there a better way?+unlit [] = []+unlit x = if (head x) == '>' then (tail x) else x++process opts file =+ let (namesOpt,opts') = getOption "names" "-names" opts in+ do xs<-readFile file+ let names = nub$ filter (\x -> (("> prop_" `isPrefixOf` x) || ("prop_" `isPrefixOf` x)))+ (map (fst.head.lex.unlit) (lines xs)) + if null names then+ putStr (file++": no properties to check\n")+ else do baseStr <- ghcBaseVersion+ writeFile "hugsin"$+ unlines ((":l "++file):+ [(if namesOpt=="+names" then + "putStr \""++p++": \" >> "+ else "") +++ "Test.QuickCheck.quickCheckWith (stdArgs { maxSuccess = 500, maxDiscard = 5000, maxSize = 100}) "++p | p<-names])+ system ("ghci -v0 -package " ++ baseStr ++ " " ++ options opts' ++ " <hugsin")+ return ()++isOption xs = head xs `elem` "-+"++options opts = unwords ["\""++opt++"\"" | opt<-opts]++getOption name def opts = + let opt = head [opt | opt<-opts++[def], isPrefixOf name (drop 1 opt)] in+ (opt, filter (/=opt) opts)+++ghcBaseVersion = + do (stdin, stdout, stderr, phandle) <- runInteractiveProcess "ghc-pkg" ["--simple-output", "list", "base"] Nothing Nothing+ str <- hGetContents stdout -- returns a string like "base-3.0.3.0 base-4.0.0.0\n"+ -- we use any base-3 version available at present, and if none is available, + -- choose the first base in the list, which should be the earliest.+ let versions = words $ init str+ return $ maybe (head versions) id (findBase3Version versions)+ where+ findBase3Version [] = Nothing+ findBase3Version (v:vs) = if "base-3" `isPrefixOf` v+ then Just v+ else findBase3Version vs
denominate.cabal view
@@ -1,5 +1,5 @@ name: denominate-version: 0.4.2+version: 0.5.0 synopsis: Functions supporting bulk file and directory name normalization. description: Denominate is a simple program and an associated library@@ -19,8 +19,8 @@ homepage: http://protempore.net/denominate/ build-type: Simple cabal-version: >= 1.2-tested-with: GHC==6.6.1 GHC==6.8.2-extra-source-files: quickcheck Makefile+tested-with: GHC==6.6.1 GHC==6.8.2 GHC==6.10.1+extra-source-files: TestRunner.hs Makefile extra-tmp-files: hugsin flag small_base@@ -29,7 +29,7 @@ library exposed-modules: System.Denominate if flag(small_base)- build-depends: base >= 3, directory, filepath+ build-depends: base >= 3.0 && < 4.0, directory, filepath else build-depends: base < 3, filepath ghc-options: -Wall -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-orphans@@ -37,7 +37,7 @@ executable denominate main-is: Main.hs if flag(small_base)- build-depends: base >= 3, directory, filepath+ build-depends: base >= 3.0 && < 4.0, directory, filepath else build-depends: base < 3, filepath ghc-options: -Wall -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-orphans
− quickcheck
@@ -1,54 +0,0 @@-#!/usr/bin/runhugs--- $Id: quickcheck,v 1.4 2003/01/08 15:09:22 shae Exp $ --- This file defines a command--- quickCheck <options> <files>--- which invokes quickCheck on all properties defined in the files given as--- arguments, by generating an input script for hugs and then invoking it.--- quickCheck recognises the options--- +names print the name of each property before checking it--- -names do not print property names (the default)--- Other options (beginning with + or -) are passed unchanged to hugs.------ Change the first line of this file to the location of runhugs on your --- system.--- Make the file executable.------ TODO:--- someone on #haskell asked about supporting QC tests inside LaTeX, ex. \{begin} \{end}, how?--- add a verbosity switch that uses verboseCheck instead of quickCheck--import System-import List--main :: IO ()-main = do as<-getArgs- sequence_ (map (process (filter isOption as)) - (filter (not.isOption) as))---- ugly hack for .lhs files, is there a better way?-unlit [] = []-unlit x = if (head x) == '>' then (tail x) else x--process opts file =- let (namesOpt,opts') = getOption "names" "-names" opts in- do xs<-readFile file- let names = nub$ filter (\x -> (("> prop_" `isPrefixOf` x) || ("prop_" `isPrefixOf` x)))- (map (fst.head.lex.unlit) (lines xs)) - if null names then- putStr (file++": no properties to check\n")- else do writeFile "hugsin"$- unlines ((":l "++file):- [(if namesOpt=="+names" then - "putStr \""++p++": \" >> "- else "") ++- "Test.QuickCheck.quickCheckWith 500 5000 100 "++p | p<-names])- system ("ghci -v0 "++options opts'++" <hugsin")- return ()--isOption xs = head xs `elem` "-+"--options opts = unwords ["\""++opt++"\"" | opt<-opts]--getOption name def opts = - let opt = head [opt | opt<-opts++[def], isPrefixOf name (drop 1 opt)] in- (opt, filter (/=opt) opts)