@@ -86,18 +86,23 @@ main = do
8686 run_ "cp" ["-rT", toTextIgnore obeliskImplRaw, toTextIgnore obeliskImpl]
8787 run_ "chown" ["-R", user, toTextIgnore obeliskImpl]
8888 run_ "chmod" ["-R", "g-rw,o-rw", toTextIgnore obeliskImpl]
89+ f obeliskImpl
8990
90− withSystemTempDirectory "init Cache λ" $ \initCache -> do
91− -- Setup the ob init cache
92− void . shellyOb verbosity $ chdir (fromString initCache) $ do
93− run_ "ob" ["init", "--symlink", toTextIgnore obeliskImpl]
94− run_ "git" ["init"]
91+ withInitCache f obeliskImpl =
92+ withSystemTempDirectory "init Cache λ" $ \initCache -> do
93+ -- Setup the ob init cache
94+ void . shellyOb verbosity $ chdir initCache $ do
95+ run_ "ob" ["init", "--symlink", toTextIgnore obeliskImpl]
96+ run_ "git" ["init"]
9597
96− f obeliskImpl initCache
98+ f initCache
99+
100+ withObeliskImplAndInitCache f =
101+ withObeliskImpl $ \impl -> withInitCache (f impl) impl
97102
98103 httpManager <- HTTP.newManager HTTP.defaultManagerSettings
99104
100− withObeliskImpl $ \obeliskImpl initCache ->
105+ withObeliskImplAndInitCache $ \obeliskImpl initCache ->
101106 hspec $ parallel $ do
102107 let shelly_ = void . shellyOb verbosity
103108
@@ -110,6 +115,13 @@ main = do
110115 run_ "cp" ["-rT", fromString initCache, toTextIgnore dir]
111116 f dir
112117
118+ -- To be used in tests that change the obelisk impl directory
119+ inTmpObInitWithImplCopy f = inTmpObInit $ \dir ->
120+ withObeliskImpl $ \(fromString -> implCopy) -> do
121+ run_ "rm" [thunk]
122+ run_ "ln" ["-s", implCopy, thunk]
123+ f dir
124+
113125 assertRevEQ a b = liftIO . assertEqual "" "" =<< diff a b
114126 assertRevNE a b = liftIO . assertBool "" . (/= "") =<< diff a b
115127
@@ -185,14 +197,14 @@ main = do
185197 it ("can enter " <> shellName) $ inTmpObInit $ \_ -> inShell "exit"
186198 it ("can build in " <> shellName) $ inTmpObInit $ \_ -> inShell $ "cabal new-build --" <> fromString compiler <> " all"
187199
188− it "has idempotent thunk update" $ inTmpObInit $ \_ -> do
200+ it "has idempotent thunk update" $ inTmpObInitWithImplCopy $ \_ -> do
189201 _ <- pack
190202 u <- update
191203 uu <- update
192204 assertRevEQ u uu
193205
194206 describe "ob thunk pack/unpack" $ parallel $ do
195− it "has thunk pack and unpack inverses" $ inTmpObInit $ \_ -> do
207+ it "has thunk pack and unpack inverses" $ inTmpObInitWithImplCopy $ \_ -> do
196208
197209 _ <- pack
198210 e <- commitAll