Skip to content

Commit 44328d7

Browse files
buzdengallais
authored andcommitted
[ fix ] Wrap paths in quotes for one more call for system
1 parent 8b9916f commit 44328d7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libs/test/Test/Golden.idr

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ normalize str =
196196
Result : Type
197197
Result = Either String String
198198

199+
guardPath : String -> String
200+
guardPath s = "\"" ++ s ++ "\""
201+
199202
||| Run the specified Golden test with the supplied options.
200203
||| See the module documentation for more information.
201204
||| @testPath the directory that contains the test.
@@ -205,7 +208,7 @@ runTest opts testPath = forkIO $ do
205208
start <- clockTime UTC
206209
let cg = maybe "" (" --cg " ++) (codegen opts)
207210
let exe = "\"" ++ exeUnderTest opts ++ cg ++ "\""
208-
ignore $ system $ "cd \"" ++ testPath ++ "\" && " ++
211+
ignore $ system $ "cd " ++ guardPath testPath ++ " && " ++
209212
"sh ./run " ++ exe ++ " | tr -d '\\r' > output"
210213
end <- clockTime UTC
211214

@@ -263,7 +266,7 @@ runTest opts testPath = forkIO $ do
263266
Just exp => do
264267
code <- system $ "git diff --no-index --exit-code " ++
265268
(if opts.color then "--word-diff=color " else "") ++
266-
testPath ++ "/expected " ++ testPath ++ "/output"
269+
guardPath testPath ++ "/expected " ++ guardPath testPath ++ "/output"
267270
putStr . unlines $
268271
["Golden value differs from actual value."] ++
269272
(if (code < 0) then expVsOut exp out else []) ++

0 commit comments

Comments
 (0)