Skip to content

Commit

Permalink
#24, make sure you test in both ?>> and *>>
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmitchell committed Jun 29, 2013
1 parent da1a861 commit 40b3e3c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Examples/Test/Files.hs
Expand Up @@ -12,17 +12,16 @@ main = shaken test $ \args obj -> do
let rest = delete "@" args
want $ map obj $ if null rest then ["even.txt","odd.txt"] else rest

let deps = map obj ["even.txt","odd.txt"]
let def | fun = (?>>) (\x -> if x `elem` deps then Just deps else Nothing)
| otherwise = (*>>) deps
let deps ?*>> act | fun = (\x -> if x `elem` deps then Just deps else Nothing) ?>> act
| otherwise = deps *>> act

def $ \[evens,odds] -> do
map obj ["even.txt","odd.txt"] ?*>> \[evens,odds] -> do
src <- readFileLines $ obj "numbers.txt"
let (es,os) = partition even $ map read src
writeFileLines evens $ map show es
writeFileLines odds $ map show os

map obj ["dir1/out.txt","dir2/out.txt"] *>> \[a,b] -> do
map obj ["dir1/out.txt","dir2/out.txt"] ?*>> \[a,b] -> do
writeFile' a "a"
writeFile' b "b"

Expand All @@ -34,5 +33,5 @@ test build obj = do
build ("--sleep":args)
assertContents (obj "even.txt") $ nums [2,4,2]
assertContents (obj "odd.txt" ) $ nums [1,5,3,1]
build ["clean"]
build ["dir1/out.txt"]
build ["clean"]
build ["dir1/out.txt"]

0 comments on commit 40b3e3c

Please sign in to comment.