Hello community,

here is the log from the commit of package hspec-discover for openSUSE:Factory 
checked in at 2018-05-30 12:16:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hspec-discover (Old)
 and      /work/SRC/openSUSE:Factory/.hspec-discover.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hspec-discover"

Wed May 30 12:16:28 2018 rev:5 rq:607962 version:2.5.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/hspec-discover/hspec-discover.changes    
2017-09-15 22:29:30.378721423 +0200
+++ /work/SRC/openSUSE:Factory/.hspec-discover.new/hspec-discover.changes       
2018-05-30 12:28:58.874721734 +0200
@@ -1,0 +2,6 @@
+Mon May 14 17:02:11 UTC 2018 - [email protected]
+
+- Update hspec-discover to version 2.5.0.
+  No change log available from upstream.
+
+-------------------------------------------------------------------

Old:
----
  hspec-discover-2.4.4.tar.gz

New:
----
  hspec-discover-2.5.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hspec-discover.spec ++++++
--- /var/tmp/diff_new_pack.KuzGBE/_old  2018-05-30 12:28:59.334705153 +0200
+++ /var/tmp/diff_new_pack.KuzGBE/_new  2018-05-30 12:28:59.334705153 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package hspec-discover
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global pkg_name hspec-discover
 %bcond_with tests
 Name:           %{pkg_name}
-Version:        2.4.4
+Version:        2.5.0
 Release:        0
 Summary:        Automatically discover and run Hspec tests
 License:        MIT
@@ -32,6 +32,7 @@
 BuildRequires:  ghc-filepath-devel
 BuildRequires:  ghc-rpm-macros
 %if %{with tests}
+BuildRequires:  ghc-QuickCheck-devel
 BuildRequires:  ghc-hspec-meta-devel
 %endif
 
@@ -78,11 +79,11 @@
 %ghc_pkg_recache
 
 %files
-%doc LICENSE
+%license LICENSE
 %{_bindir}/%{name}
 
 %files -n ghc-%{name} -f ghc-%{name}.files
-%doc LICENSE
+%license LICENSE
 
 %files -n ghc-%{name}-devel -f ghc-%{name}-devel.files
 

++++++ hspec-discover-2.4.4.tar.gz -> hspec-discover-2.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-discover-2.4.4/hspec-discover.cabal 
new/hspec-discover-2.5.0/hspec-discover.cabal
--- old/hspec-discover-2.4.4/hspec-discover.cabal       2017-06-16 
11:08:31.000000000 +0200
+++ new/hspec-discover-2.5.0/hspec-discover.cabal       2018-03-14 
10:17:49.000000000 +0100
@@ -1,9 +1,9 @@
--- This file has been generated from package.yaml by hpack version 0.18.0.
+-- This file has been generated from package.yaml by hpack version 0.19.0.
 --
 -- see: https://github.com/sol/hpack
 
 name:             hspec-discover
-version:          2.4.4
+version:          2.5.0
 license:          MIT
 license-file:     LICENSE
 copyright:        (c) 2012-2017 Simon Hengel
@@ -36,13 +36,14 @@
       src
   ghc-options: -Wall
   build-depends:
-      base == 4.*
-    , filepath
+      base ==4.*
     , directory
+    , filepath
   exposed: False
   exposed-modules:
       Test.Hspec.Discover.Config
       Test.Hspec.Discover.Run
+      Test.Hspec.Discover.Sort
   other-modules:
       Paths_hspec_discover
   default-language: Haskell2010
@@ -53,10 +54,12 @@
       driver
   main-is: hspec-discover.hs
   build-depends:
-      base == 4.*
-    , filepath
+      base ==4.*
     , directory
+    , filepath
     , hspec-discover
+  other-modules:
+      Paths_hspec_discover
   default-language: Haskell2010
 
 test-suite spec
@@ -69,10 +72,13 @@
       Helper
       Test.Hspec.Discover.ConfigSpec
       Test.Hspec.Discover.RunSpec
+      Test.Hspec.Discover.SortSpec
+      Paths_hspec_discover
   build-depends:
-      base == 4.*
-    , filepath
+      base ==4.*
     , directory
+    , filepath
     , hspec-discover
-    , hspec-meta >= 2.3.2
+    , hspec-meta >=2.3.2
+    , QuickCheck >= 2.7
   default-language: Haskell2010
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-discover-2.4.4/src/Test/Hspec/Discover/Run.hs 
new/hspec-discover-2.5.0/src/Test/Hspec/Discover/Run.hs
--- old/hspec-discover-2.4.4/src/Test/Hspec/Discover/Run.hs     2017-06-16 
11:08:31.000000000 +0200
+++ new/hspec-discover-2.5.0/src/Test/Hspec/Discover/Run.hs     2018-03-14 
10:17:49.000000000 +0100
@@ -30,6 +30,7 @@
 import           System.FilePath hiding (combine)
 
 import           Test.Hspec.Discover.Config
+import           Test.Hspec.Discover.Sort
 
 instance IsString ShowS where
   fromString = showString
@@ -141,7 +142,8 @@
 isValidModuleChar c = isAlphaNum c || c == '_' || c == '\''
 
 getFilesRecursive :: FilePath -> IO [FilePath]
-getFilesRecursive baseDir = sort <$> go []
+getFilesRecursive baseDir = sortNaturally <$> go []
+
   where
     go :: FilePath -> IO [FilePath]
     go dir = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/hspec-discover-2.4.4/src/Test/Hspec/Discover/Sort.hs 
new/hspec-discover-2.5.0/src/Test/Hspec/Discover/Sort.hs
--- old/hspec-discover-2.4.4/src/Test/Hspec/Discover/Sort.hs    1970-01-01 
01:00:00.000000000 +0100
+++ new/hspec-discover-2.5.0/src/Test/Hspec/Discover/Sort.hs    2018-03-14 
10:17:49.000000000 +0100
@@ -0,0 +1,30 @@
+module Test.Hspec.Discover.Sort (
+  sortNaturally
+, NaturalSortKey
+, naturalSortKey
+) where
+
+import           Control.Arrow
+import           Data.Char
+import           Data.List
+import           Data.Ord
+
+sortNaturally :: [String] -> [String]
+sortNaturally = sortBy (comparing naturalSortKey)
+
+data NaturalSortKey = NaturalSortKey [Chunk]
+  deriving (Eq, Ord)
+
+data Chunk = Numeric Integer Int | Textual [(Char, Char)]
+  deriving (Eq, Ord)
+
+naturalSortKey :: String -> NaturalSortKey
+naturalSortKey = NaturalSortKey . chunks
+  where
+    chunks [] = []
+    chunks s@(c:_)
+      | isDigit c = Numeric (read num) (length num) : chunks afterNum
+      | otherwise = Textual (map (toLower &&& id) str) : chunks afterStr
+      where
+        (num, afterNum) = span  isDigit s
+        (str, afterStr) = break isDigit s
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/hspec-discover-2.4.4/test/Test/Hspec/Discover/SortSpec.hs 
new/hspec-discover-2.5.0/test/Test/Hspec/Discover/SortSpec.hs
--- old/hspec-discover-2.4.4/test/Test/Hspec/Discover/SortSpec.hs       
1970-01-01 01:00:00.000000000 +0100
+++ new/hspec-discover-2.5.0/test/Test/Hspec/Discover/SortSpec.hs       
2018-03-14 10:17:49.000000000 +0100
@@ -0,0 +1,83 @@
+module Test.Hspec.Discover.SortSpec (main, spec) where
+
+import           Helper
+import           Test.QuickCheck
+
+import           Test.Hspec.Discover.Sort
+
+main :: IO ()
+main = hspec spec
+
+shuffleAndSort :: [String] -> IO [String]
+shuffleAndSort xs = sortNaturally <$> generate (shuffle xs)
+
+spec :: Spec
+spec = do
+  describe "naturalSortKey" $ do
+    it "is injective" $ property $ \ a  b -> do
+      a /= b ==> naturalSortKey a /= naturalSortKey b
+
+  describe "sortNaturally" $ do
+    it "gives shorter strings precedence" $ do
+      let expected = [
+              ""
+            , "a"
+            , "aa"
+            ]
+      shuffleAndSort expected `shouldReturn` expected
+
+    it "gives numbers precedence" $ do
+      let expected = [
+              "Hello2World"
+            , "Hello World"
+            ]
+      shuffleAndSort expected `shouldReturn` expected
+
+    it "sorts numbers in ascending order" $ do
+      let expected = [
+              "Spec9.hs"
+            , "Spec10.hs"
+            ]
+      shuffleAndSort expected `shouldReturn` expected
+
+    it "breaks numeric ties by string length" $ do
+      let expected = [
+              "Hello 2 World"
+            , "Hello 02 World"
+            ]
+      shuffleAndSort expected `shouldReturn` expected
+
+    it "given upper-case letters precedence over lower-case letters" $ do
+      let
+        expected = [
+            "AA.hs"
+          , "Aa.hs"
+          , "aA.hs"
+          , "aa.hs"
+          , "B.hs"
+          , "b.hs"
+          ]
+      shuffleAndSort expected `shouldReturn` expected
+
+    it "sorts number separated strings" $ do
+      let expected = [
+              "Hello2World9"
+            , "Hello2World!0"
+            ]
+      shuffleAndSort expected `shouldReturn` expected
+
+    it "sorts string separated numbers" $ do
+      let expected = [
+              "3.1.415"
+            , "3.14.15"
+            ]
+      shuffleAndSort expected `shouldReturn` expected
+
+    it "groups common string prefixes together" $ do
+      let expected = [
+              "SpecFoo.hs"
+            , "SpecFoo.lhs"
+            , "Specfoo.hs"
+            , "Specfoo.lhs"
+            ]
+      shuffleAndSort expected `shouldReturn` expected


Reply via email to