[commit: packages/time] format-widths, ghc, master: test: separate Unix-specific test stanza (b13119e)

git at git.haskell.org git at git.haskell.org
Fri Apr 21 16:56:50 UTC 2017


Repository : ssh://git@git.haskell.org/time

On branches: format-widths,ghc,master
Link       : http://git.haskell.org/packages/time.git/commitdiff/b13119e1557c3edfbc9d6fee7311671e55b6e16b

>---------------------------------------------------------------

commit b13119e1557c3edfbc9d6fee7311671e55b6e16b
Author: Ashley Yakeley <ashley at yakeley.org>
Date:   Fri Feb 3 14:09:12 2017 -0800

    test: separate Unix-specific test stanza


>---------------------------------------------------------------

b13119e1557c3edfbc9d6fee7311671e55b6e16b
 test/main/Main.hs                              |  4 +---
 test/unix/Main.hs                              | 20 +++++++++++++++++
 test/{main => unix}/Test/LocalTime/TimeZone.hs |  0
 time.cabal                                     | 30 ++++++++++++++++++++++++--
 4 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/test/main/Main.hs b/test/main/Main.hs
index e0c3eaf..8f205e3 100644
--- a/test/main/Main.hs
+++ b/test/main/Main.hs
@@ -16,7 +16,6 @@ import Test.Clock.TAI
 import Test.Format.Format
 import Test.Format.ParseTime
 import Test.LocalTime.Time
-import Test.LocalTime.TimeZone
 
 
 tests :: TestTree
@@ -41,8 +40,7 @@ tests = testGroup "Time" [
         testParseTime
         ],
     testGroup "LocalTime" [
-        testTime,
-        testTimeZone
+        testTime
         ]
     ]
 
diff --git a/test/unix/Main.hs b/test/unix/Main.hs
new file mode 100644
index 0000000..8d1b932
--- /dev/null
+++ b/test/unix/Main.hs
@@ -0,0 +1,20 @@
+module Main where
+
+import Foreign.C.Types
+import Test.Tasty
+import Test.LocalTime.TimeZone
+
+
+tests :: TestTree
+tests = testGroup "Time" [
+    testGroup "LocalTime" [
+        testTimeZone
+        ]
+    ]
+
+main :: IO ()
+main = do
+  if (toRational (1000000000000 :: CTime)) /= (1000000000000 :: Rational)
+    then putStrLn "WARNING: Some tests will incorrectly fail due to a 32-bit time_t C type."
+    else return ()
+  defaultMain tests
diff --git a/test/main/Test/LocalTime/TimeZone.hs b/test/unix/Test/LocalTime/TimeZone.hs
similarity index 100%
rename from test/main/Test/LocalTime/TimeZone.hs
rename to test/unix/Test/LocalTime/TimeZone.hs
diff --git a/time.cabal b/time.cabal
index cc43eff..a30fc45 100644
--- a/time.cabal
+++ b/time.cabal
@@ -133,8 +133,7 @@ test-suite test-main
         QuickCheck,
         tasty,
         tasty-hunit,
-        tasty-quickcheck,
-        unix
+        tasty-quickcheck
     main-is: Main.hs
     other-modules:
         Test.TestUtil
@@ -159,4 +158,31 @@ test-suite test-main
         Test.Format.ParseTime
         Test.LocalTime.Time
         Test.LocalTime.TimeRef
+
+test-suite test-unix
+    type: exitcode-stdio-1.0
+    hs-source-dirs: test/unix
+    default-language: Haskell2010
+    default-extensions:
+        Rank2Types
+        CPP
+        DeriveDataTypeable
+        StandaloneDeriving
+        ExistentialQuantification
+        MultiParamTypeClasses
+        FlexibleInstances
+        UndecidableInstances
+        ScopedTypeVariables
+    ghc-options: -Wall -fwarn-tabs
+    build-depends:
+        base,
+        deepseq,
+        time,
+        unix,
+        QuickCheck,
+        tasty,
+        tasty-hunit,
+        tasty-quickcheck
+    main-is: Main.hs
+    other-modules:
         Test.LocalTime.TimeZone



More information about the ghc-commits mailing list