on master help sign in
Resolve warnings, add missing files
commit5ab965f264ee5698450a68c2c5e333460626077b authorMichael Xavier <michael@michaelxavier.net> dateWed 30 Nov 2016, 09:44 (10 years ago) parent7c73cbd
4 files changed+23−15
katip/katip.cabal+10−1 katip/test/Katip/Tests.hs+2−2 katip/test/Katip/Tests/Format/Time.hs+6−6 katip/test/Katip/Tests/Scribes/Handle.hs+5−6
katip/katip.cabal+10−1
@@ -23,6 +23,8 @@ extra-source-files:
2323 test/Main.hs
2424 test/Katip/Tests.hs
2525 test/Katip/Tests/Scribes/Handle.hs
26+ test/Katip/Tests/Scribes/Handle-text.golden
27+ test/Katip/Tests/Format/Time.hs
2628tested-with: GHC == 7.8.4, GHC== 7.10.3
2729
2830source-repository head
@@ -86,6 +88,10 @@ test-suite test
8688 type: exitcode-stdio-1.0
8789 main-is: Main.hs
8890 hs-source-dirs: test
91+ other-modules:
92+ Katip.Tests.Format.Time
93+ Katip.Tests.Scribes.Handle
94+ Katip.Tests
8995 default-language: Haskell2010
9096 build-depends: base
9197 , katip
@@ -100,11 +106,14 @@ test-suite test
100106 , text
101107 , time
102108 , time-locale-compat >= 0.1.0.1 && < 0.2
103− , temporary
104109 , directory
105110 , regex-tdfa
106111 , unordered-containers
107112 , microlens
113+ ghc-options: -Wall
114+ if flag(lib-Werror)
115+ ghc-options: -Werror
116+
108117
109118benchmark bench
110119 type: exitcode-stdio-1.0
katip/test/Katip/Tests.hs+2−2
@@ -11,7 +11,7 @@ module Katip.Tests
1111
1212
1313-------------------------------------------------------------------------------
14−import Control.Applicative
14+import Control.Applicative as A
1515import Data.Aeson
1616import qualified Data.HashMap.Strict as HM
1717import Data.Monoid
@@ -93,7 +93,7 @@ prop_json_cycle a = eitherDecode (encode a) === Right a
9393-------------------------------------------------------------------------------
9494instance Arbitrary a => Arbitrary (Item a) where
9595 arbitrary = Item
96− <$> arbitrary
96+ A.<$> arbitrary
9797 <*> arbitrary
9898 <*> arbitrary
9999 <*> arbitrary
katip/test/Katip/Tests/Format/Time.hs+6−6
@@ -1,19 +1,20 @@
1−
21module Katip.Tests.Format.Time
32 ( tests
43 ) where
54
5+-------------------------------------------------------------------------------
66import Data.Aeson (toJSON)
77import qualified Data.Text as Text
88import Data.Time
99import Data.Time.Clock.POSIX
1010import qualified Data.Time.Locale.Compat as LC
11−
1211import Test.Tasty
1312import Test.Tasty.HUnit
1413import Test.Tasty.QuickCheck
15−
14+-------------------------------------------------------------------------------
1615import Katip.Format.Time
16+-------------------------------------------------------------------------------
17+
1718
1819tests :: TestTree
1920tests = testGroup "Katip.Format.Time"
@@ -72,9 +73,8 @@ prop_format_aeson :: UTCTime -> Property
7273prop_format_aeson a = toJSON a === toJSON (formatAsIso8601 a)
7374
7475
75−newtype ArbUTCTime = ArbUTCTime {
76− unArbUTCTime :: UTCTime
77− } deriving (Show)
76+newtype ArbUTCTime = ArbUTCTime UTCTime
77+ deriving (Show)
7878
7979instance Arbitrary ArbUTCTime where
8080 arbitrary = fmap (ArbUTCTime . posixSecondsToUTCTime . fromInteger)
katip/test/Katip/Tests/Scribes/Handle.hs+5−6
@@ -18,7 +18,6 @@ import Language.Haskell.TH.Syntax (Loc (..))
1818import Lens.Micro ((.~))
1919import System.Directory
2020import System.IO
21−import System.IO.Temp
2221import Test.Tasty
2322import Test.Tasty.Golden
2423import Test.Tasty.HUnit
@@ -40,10 +39,10 @@ tests = testGroup "Katip.Scribes.Handle"
4039 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
4140 let matches = res =~ pat
4241 assertBool (res <> " did not match") matches
43− , withResource setupTempFile teardownTempFile $ \setup ->
42+ , withResource setupTempFile teardownTempFile $ \setupFn ->
4443 goldenVsString "Text-golden"
4544 "test/Katip/Tests/Scribes/Handle-text.golden"
46− (setup >>= writeTextLog)
45+ (setupFn >>= writeTextLog)
4746 ]
4847
4948
@@ -54,8 +53,8 @@ data DummyLogItem = DummyLogItem {
5453
5554
5655instance ToJSON DummyLogItem where
57− toJSON (DummyLogItem n) = object
58− [ "note" .= object [ "deep" .= n
56+ toJSON dli = object
57+ [ "note" .= object [ "deep" .= dliNote dli
5958 ]
6059 ]
6160
@@ -143,7 +142,7 @@ genItems = concat $
143142 | s <- [minBound .. maxBound]
144143 ]
145144 , [ itemThread .~ (ThreadIdText . T.pack $ show t) $ theItem
146− | t <- [0, 1, 1337, 2147483647]
145+ | t <- [0 :: Int, 1, 1337, 2147483647]
147146 ]
148147 , [ itemHost .~ h $ theItem
149148 | h <- ["example", "www.example.com", "127.0.0.1"]