summaryrefslogtreecommitdiff
path: root/dev-haskell/foldl/files/foldl-1.4.12-cabal-doctest.patch
blob: 648b8f77cbc33f4cd509ecc99bae0d3064d90b79 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
diff -urN foldl-1.4.12/Setup.hs foldl-1.4.12-r1/Setup.hs
--- foldl-1.4.12/Setup.hs	2001-09-08 19:46:40.000000000 -0600
+++ foldl-1.4.12-r1/Setup.hs	2022-03-23 03:20:48.427151688 -0600
@@ -1,2 +1,6 @@
-import Distribution.Simple
-main = defaultMain
+module Main (main) where
+
+import Distribution.Extra.Doctest ( defaultMainWithDoctests )
+
+main :: IO ()
+main = defaultMainWithDoctests "doctest"
diff -urN foldl-1.4.12/foldl.cabal foldl-1.4.12-r1/foldl.cabal
--- foldl-1.4.12/foldl.cabal	2022-03-23 03:17:07.317151581 -0600
+++ foldl-1.4.12-r1/foldl.cabal	2022-03-23 03:20:10.187151669 -0600
@@ -2,7 +2,7 @@
 Version: 1.4.12
 x-revision: 2
 Cabal-Version: >=1.10
-Build-Type: Simple
+Build-Type: Custom
 License: BSD3
 License-File: LICENSE
 Copyright: 2013 Gabriel Gonzalez
@@ -22,6 +22,12 @@
     Type: git
     Location: https://github.com/Gabriel439/Haskell-Foldl-Library
 
+custom-setup
+    setup-depends:
+        base
+      , Cabal
+      , cabal-doctest
+
 Library
     HS-Source-Dirs: src
     Build-Depends:
@@ -83,6 +89,9 @@
     Main-Is: doctest.hs
     Build-Depends:
         base,
-        doctest >= 0.16
+        doctest >= 0.16,
+        directory,
+        filepath,
+        base-compat
     GHC-Options: -threaded
     Default-Language: Haskell2010
diff -urN foldl-1.4.12/test/doctest.hs foldl-1.4.12-r1/test/doctest.hs
--- foldl-1.4.12/test/doctest.hs	2001-09-08 19:46:40.000000000 -0600
+++ foldl-1.4.12-r1/test/doctest.hs	2022-03-23 03:22:41.077151743 -0600
@@ -1,4 +1,29 @@
 import Test.DocTest
+import GHC.IO.Encoding (setLocaleEncoding)
+import System.Directory (getCurrentDirectory, makeAbsolute)
+import System.FilePath.Posix ((</>))
+import System.IO (utf8)
+import Build_doctests (pkgs)
+ 
+main = do
+    setLocaleEncoding utf8
+    pwd    <- getCurrentDirectory
+    prefix <- makeAbsolute pwd
 
-main :: IO ()
-main = doctest ["-isrc", "src/Control/Foldl.hs", "src/Control/Scanl.hs"]
+    let customFlags =
+            [ "-package-env=-"
+            , "-hide-all-packages"
+            , "-no-user-package-db"
+            , "-package-db=" ++ prefix </> "dist/package.conf.inplace"
+            ]
+
+    let origFlags =
+            [ "-isrc"
+            ]
+
+    let modules =
+            [ "src/Control/Foldl.hs"
+            , "src/Control/Scanl.hs"
+            ]
+
+    doctest $ customFlags ++ pkgs ++ origFlags ++ modules