on master help sign in
Resolve warnings, add missing files
5ab965fMichael Xavier
katip/katip.cabal+10−1
@@ -23,6 +23,8 @@ extra-source-files:
23 test/Main.hs
23 test/Main.hs
24 test/Katip/Tests.hs
24 test/Katip/Tests.hs
25 test/Katip/Tests/Scribes/Handle.hs
25 test/Katip/Tests/Scribes/Handle.hs
26+ test/Katip/Tests/Scribes/Handle-text.golden
27+ test/Katip/Tests/Format/Time.hs
26tested-with: GHC == 7.8.4, GHC== 7.10.3
28tested-with: GHC == 7.8.4, GHC== 7.10.3
27
29
28source-repository head
30source-repository head
@@ -86,6 +88,10 @@ test-suite test
86 type: exitcode-stdio-1.0
88 type: exitcode-stdio-1.0
87 main-is: Main.hs
89 main-is: Main.hs
88 hs-source-dirs: test
90 hs-source-dirs: test
91+ other-modules:
92+ Katip.Tests.Format.Time
93+ Katip.Tests.Scribes.Handle
94+ Katip.Tests
89 default-language: Haskell2010
95 default-language: Haskell2010
90 build-depends: base
96 build-depends: base
91 , katip
97 , katip
@@ -100,11 +106,14 @@ test-suite test
100 , text
106 , text
101 , time
107 , time
102 , time-locale-compat >= 0.1.0.1 && < 0.2
108 , time-locale-compat >= 0.1.0.1 && < 0.2
103− , temporary
104 , directory
109 , directory
105 , regex-tdfa
110 , regex-tdfa
106 , unordered-containers
111 , unordered-containers
107 , microlens
112 , microlens
113+ ghc-options: -Wall
114+ if flag(lib-Werror)
115+ ghc-options: -Werror
116+
108
117
109benchmark bench
118benchmark bench
110 type: exitcode-stdio-1.0
119 type: exitcode-stdio-1.0
katip/test/Katip/Tests.hs+2−2
@@ -11,7 +11,7 @@ module Katip.Tests
11
11
12
12
13-------------------------------------------------------------------------------
13-------------------------------------------------------------------------------
14−import Control.Applicative
14+import Control.Applicative as A
15import Data.Aeson
15import Data.Aeson
16import qualified Data.HashMap.Strict as HM
16import qualified Data.HashMap.Strict as HM
17import Data.Monoid
17import Data.Monoid
@@ -93,7 +93,7 @@ prop_json_cycle a = eitherDecode (encode a) === Right a
93-------------------------------------------------------------------------------
93-------------------------------------------------------------------------------
94instance Arbitrary a => Arbitrary (Item a) where
94instance Arbitrary a => Arbitrary (Item a) where
95 arbitrary = Item
95 arbitrary = Item
96− <$> arbitrary
96+ A.<$> arbitrary
97 <*> arbitrary
97 <*> arbitrary
98 <*> arbitrary
98 <*> arbitrary
99 <*> arbitrary
99 <*> arbitrary
katip/test/Katip/Tests/Format/Time.hs+6−6
@@ -1,19 +1,20 @@
1−
2module Katip.Tests.Format.Time
1module Katip.Tests.Format.Time
3 ( tests
2 ( tests
4 ) where
3 ) where
5
4
5+-------------------------------------------------------------------------------
6import Data.Aeson (toJSON)
6import Data.Aeson (toJSON)
7import qualified Data.Text as Text
7import qualified Data.Text as Text
8import Data.Time
8import Data.Time
9import Data.Time.Clock.POSIX
9import Data.Time.Clock.POSIX
10import qualified Data.Time.Locale.Compat as LC
10import qualified Data.Time.Locale.Compat as LC
11−
12import Test.Tasty
11import Test.Tasty
13import Test.Tasty.HUnit
12import Test.Tasty.HUnit
14import Test.Tasty.QuickCheck
13import Test.Tasty.QuickCheck
15−
14+-------------------------------------------------------------------------------
16import Katip.Format.Time
15import Katip.Format.Time
16+-------------------------------------------------------------------------------
17+
17
18
18tests :: TestTree
19tests :: TestTree
19tests = testGroup "Katip.Format.Time"
20tests = testGroup "Katip.Format.Time"
@@ -72,9 +73,8 @@ prop_format_aeson :: UTCTime -> Property
72prop_format_aeson a = toJSON a === toJSON (formatAsIso8601 a)
73prop_format_aeson a = toJSON a === toJSON (formatAsIso8601 a)
73
74
74
75
75−newtype ArbUTCTime = ArbUTCTime {
76+newtype ArbUTCTime = ArbUTCTime UTCTime
76− unArbUTCTime :: UTCTime
77− } deriving (Show)
77+ deriving (Show)
78
78
79instance Arbitrary ArbUTCTime where
79instance Arbitrary ArbUTCTime where
80 arbitrary = fmap (ArbUTCTime . posixSecondsToUTCTime . fromInteger)
80 arbitrary = fmap (ArbUTCTime . posixSecondsToUTCTime . fromInteger)
katip/test/Katip/Tests/Scribes/Handle.hs+5−6
@@ -18,7 +18,6 @@ import Language.Haskell.TH.Syntax (Loc (..))
18import Lens.Micro ((.~))
18import Lens.Micro ((.~))
19import System.Directory
19import System.Directory
20import System.IO
20import System.IO
21−import System.IO.Temp
22import Test.Tasty
21import Test.Tasty
23import Test.Tasty.Golden
22import Test.Tasty.Golden
24import Test.Tasty.HUnit
23import Test.Tasty.HUnit
@@ -40,10 +39,10 @@ tests = testGroup "Katip.Scribes.Handle"
40 let pat = "\\[[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}\\]\\[katip-test.test\\]\\[Info\\]\\[.+\\]\\[[[:digit:]]+\\]\\[ThreadId [[:digit:]]+\\]\\[note.deep:some note\\] test message" :: String
39 let pat = "\\[[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2} [[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}\\]\\[katip-test.test\\]\\[Info\\]\\[.+\\]\\[[[:digit:]]+\\]\\[ThreadId [[:digit:]]+\\]\\[note.deep:some note\\] test message" :: String
41 let matches = res =~ pat
40 let matches = res =~ pat
42 assertBool (res <> " did not match") matches
41 assertBool (res <> " did not match") matches
43− , withResource setupTempFile teardownTempFile $ \setup ->
42+ , withResource setupTempFile teardownTempFile $ \setupFn ->
44 goldenVsString "Text-golden"
43 goldenVsString "Text-golden"
45 "test/Katip/Tests/Scribes/Handle-text.golden"
44 "test/Katip/Tests/Scribes/Handle-text.golden"
46− (setup >>= writeTextLog)
45+ (setupFn >>= writeTextLog)
47 ]
46 ]
48
47
49
48
@@ -54,8 +53,8 @@ data DummyLogItem = DummyLogItem {
54
53
55
54
56instance ToJSON DummyLogItem where
55instance ToJSON DummyLogItem where
57− toJSON (DummyLogItem n) = object
56+ toJSON dli = object
58− [ "note" .= object [ "deep" .= n
57+ [ "note" .= object [ "deep" .= dliNote dli
59 ]
58 ]
60 ]
59 ]
61
60
@@ -143,7 +142,7 @@ genItems = concat $
143 | s <- [minBound .. maxBound]
142 | s <- [minBound .. maxBound]
144 ]
143 ]
145 , [ itemThread .~ (ThreadIdText . T.pack $ show t) $ theItem
144 , [ itemThread .~ (ThreadIdText . T.pack $ show t) $ theItem
146− | t <- [0, 1, 1337, 2147483647]
145+ | t <- [0 :: Int, 1, 1337, 2147483647]
147 ]
146 ]
148 , [ itemHost .~ h $ theItem
147 , [ itemHost .~ h $ theItem
149 | h <- ["example", "www.example.com", "127.0.0.1"]
148 | h <- ["example", "www.example.com", "127.0.0.1"]