|
1 | 1 | import System.Process
|
| 2 | +import Distribution.System (OS(Windows,Linux,OSX), buildOS) |
2 | 3 | import Test.Cabal.Prelude
|
3 | 4 |
|
4 |
| - |
5 | 5 | main = cabalTest $ do
|
6 | 6 | r <- cabal' "man" ["--raw"]
|
7 | 7 | assertOutputContains ".B cabal install" r
|
8 | 8 | assertOutputDoesNotContain ".B cabal manpage" r
|
9 | 9 |
|
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