on master help sign in
Fix test fail on mac
9e4ad67Niklas Larsson
test/TestRun.hs+9−3
@@ -70,10 +70,16 @@ test name path act =
70 cmp x y = return $ if normalize x == normalize y then Nothing
70 cmp x y = return $ if normalize x == normalize y then Nothing
71 else Just $ printDiff (ref, x) (new, y)
71 else Just $ printDiff (ref, x) (new, y)
72 upd = writeFile ref
72 upd = writeFile ref
73+ -- just pretend that backslashes are slashes for comparison
74+ -- purposes to avoid path problems, so don't write any tests
75+ -- that depend on that distinction in other contexts.
76+ -- Also compare CRLF and LF as equal, fixes a weird corner case
77+ -- on Mac where basic010 and reg039 produces CRLF
73 normalize [] = []
78 normalize [] = []
79+ normalize ('\r':'\n':xs) = '\n' : normalize xs
74− normalize ('\\':'\\':xs) = '/':normalize xs
80+ normalize ('\\':'\\':xs) = '/' : normalize xs
75− normalize ('\\':xs) = '/':normalize xs
81+ normalize ('\\':xs) = '/' : normalize xs
76− normalize (x:xs) = x:normalize xs
82+ normalize (x : xs) = x : normalize xs
77
83
78
84
79-- Takes the filepath and content of `expected` and `output`
85-- Takes the filepath and content of `expected` and `output`