Make Markdown example a code block
[cabal.git] / Cabal-tests / tests / UnitTests / Distribution / Simple / Program / Internal.hs
blob4766cbb36c50680153cafa69af17abc652f2fbc4
1 module UnitTests.Distribution.Simple.Program.Internal
2 ( tests
3 ) where
5 import Distribution.Simple.Program.Internal ( stripExtractVersion )
7 import Test.Tasty
8 import Test.Tasty.HUnit
10 v :: String
11 v = "GNU strip (GNU Binutils; openSUSE 13.2) 2.24.0.20140403-6.1\nCopyright 2013\
12 \ Free Software Foundation, Inc.\nThis program is free software; you may\
13 \ redistribute it under the terms of\nthe GNU General Public License version 3\
14 \ or (at your option) any later version.\nThis program has absolutely no\
15 \ warranty.\n"
17 v' :: String
18 v' = "GNU strip 2.17.50.0.6-26.el5 20061020"
20 v'' :: String
21 v'' = "GNU strip (openSUSE-13.2) 2.23.50.0.6-26.el5 20061020"
23 v''' :: String
24 v''' = "GNU strip (GNU (Binutils for) Ubuntu 12.04 ) 2.22"
26 tests :: [TestTree]
27 tests =
28 [ testCase "Handles parentheses" $
29 (stripExtractVersion v) @=? "2.24"
30 , testCase "Handles dashes and alphabetic characters" $
31 (stripExtractVersion v') @=? "2.17"
32 , testCase "Handles single-word parenthetical expressions" $
33 (stripExtractVersion v'') @=? "2.23"
34 , testCase "Handles nested parentheses" $
35 (stripExtractVersion v''') @=? "2.22"