Skip to content

Commit ad307fc

Browse files
committed
Re haskell#7714: don't test nroff-ability of cabal man --raw under Windows
Windows does not have `nroff` (neither has it `man`) and `cabal man` fails there usually for lack of these backends.
1 parent 68d4a18 commit ad307fc

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
import System.Process
2+
import Distribution.System (OS(Windows,Linux,OSX), buildOS)
23
import Test.Cabal.Prelude
34

4-
55
main = cabalTest $ do
66
r <- cabal' "man" ["--raw"]
77
assertOutputContains ".B cabal install" r
88
assertOutputDoesNotContain ".B cabal manpage" r
99

10-
-- Check that output of `cabal man --raw` can be passed through `nroff -man`
11-
-- without producing any warnings (which are printed to stderr).
12-
--
13-
-- NB: runM is not suitable as it mixes stdout and stderr
14-
-- r2 <- runM "nroff" ["-man", "/dev/stdin"] $ Just $ resultOutput r
15-
(ec, _output, errors) <- liftIO $
16-
readProcessWithExitCode "nroff" ["-man", "/dev/stdin"] $ resultOutput r
17-
unless (null errors) $
18-
assertFailure $ unlines
19-
[ "Error: unexpected warnings produced by `nroff -man`:"
20-
, errors
21-
]
10+
-- The following test of `cabal man` needs `nroff` which is not available under Windows.
11+
unless (buildOS == Windows) $ do
12+
13+
-- Check that output of `cabal man --raw` can be passed through `nroff -man`
14+
-- without producing any warnings (which are printed to stderr).
15+
--
16+
-- NB: runM is not suitable as it mixes stdout and stderr
17+
-- r2 <- runM "nroff" ["-man", "/dev/stdin"] $ Just $ resultOutput r
18+
(ec, _output, errors) <- liftIO $
19+
readProcessWithExitCode "nroff" ["-man", "/dev/stdin"] $ resultOutput r
20+
unless (null errors) $
21+
assertFailure $ unlines
22+
[ "Error: unexpected warnings produced by `nroff -man`:"
23+
, errors
24+
]

0 commit comments

Comments
 (0)