Hello community,

here is the log from the commit of package ghc-network-uri for openSUSE:Factory 
checked in at 2016-03-26 15:26:06
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-network-uri (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-network-uri.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-network-uri"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-network-uri/ghc-network-uri.changes  
2015-05-27 12:42:21.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-network-uri.new/ghc-network-uri.changes     
2016-03-26 15:26:08.000000000 +0100
@@ -1,0 +2,5 @@
+Mon Mar 21 07:50:36 UTC 2016 - mimi...@gmail.com
+
+- update to 2.6.1.0 
+
+-------------------------------------------------------------------

Old:
----
  network-uri-2.6.0.3.tar.gz

New:
----
  network-uri-2.6.1.0.tar.gz

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

Other differences:
------------------
++++++ ghc-network-uri.spec ++++++
--- /var/tmp/diff_new_pack.smupsI/_old  2016-03-26 15:26:09.000000000 +0100
+++ /var/tmp/diff_new_pack.smupsI/_new  2016-03-26 15:26:09.000000000 +0100
@@ -21,7 +21,7 @@
 %bcond_with tests
 
 Name:           ghc-network-uri
-Version:        2.6.0.3
+Version:        2.6.1.0
 Release:        0
 Summary:        URI manipulation
 License:        BSD-3-Clause

++++++ network-uri-2.6.0.3.tar.gz -> network-uri-2.6.1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/network-uri-2.6.0.3/Network/URI.hs 
new/network-uri-2.6.1.0/Network/URI.hs
--- old/network-uri-2.6.0.3/Network/URI.hs      2015-05-03 23:07:21.000000000 
+0200
+++ new/network-uri-2.6.1.0/Network/URI.hs      2016-03-19 21:56:32.000000000 
+0100
@@ -103,6 +103,7 @@
     , escapeURIChar
     , escapeURIString
     , unEscapeString
+    , pathSegments
 
     -- * URI Normalization functions
     , normalizeCase
@@ -126,12 +127,16 @@
 
 import Control.Applicative
 import Control.Monad (MonadPlus(..))
-import Data.Traversable (sequenceA)
 import Control.DeepSeq (NFData(rnf), deepseq)
 import Data.Char (ord, chr, isHexDigit, toLower, toUpper, digitToInt)
 import Data.Bits ((.|.),(.&.),shiftL,shiftR)
+import Data.List (unfoldr)
 import Numeric (showIntAtBase)
 
+#if !MIN_VERSION_base(4,8,0)
+import Data.Traversable (sequenceA)
+#endif
+
 import Data.Typeable (Typeable)
 #if MIN_VERSION_base(4,0,0)
 import Data.Data (Data)
@@ -871,11 +876,15 @@
 
 -- | Returns 'True' if the character is allowed unescaped in a URI.
 --
+-- >>> escapeURIString isUnescapedInURI 
"http://haskell.org:80?some_param=true&other_param=їґ";
+-- "http://haskell.org:80?some_param=true&other_param=%D1%97%D2%91";
 isUnescapedInURI :: Char -> Bool
 isUnescapedInURI c = isReserved c || isUnreserved c
 
 -- | Returns 'True' if the character is allowed unescaped in a URI component.
 --
+-- >>> escapeURIString isUnescapedInURIComponent 
"http://haskell.org:80?some_param=true&other_param=їґ";
+-- 
"http%3A%2F%2Fhaskell.org%3A80%3Fsome_param%3Dtrue%26other_param%3D%D1%97%D2%91"
 isUnescapedInURIComponent :: Char -> Bool
 isUnescapedInURIComponent c = not (isReserved c || not (isUnescapedInURI c))
 
@@ -1080,7 +1089,24 @@
         (r,'/':ps1) -> (r++"/",ps1)
         (r,_)       -> (r,[])
 
---  Split last (name) segment from path, returning (path,name)
+segments :: String -> [String]
+segments str = dropLeadingEmpty $ unfoldr nextSegmentMaybe str
+    where
+        nextSegmentMaybe "" = Nothing
+        nextSegmentMaybe ps =
+            case break (=='/') ps of
+                (seg, '/':ps1) -> Just (seg, ps1)
+                (seg, _)       -> Just (seg, "")
+        dropLeadingEmpty ("":xs) = xs
+        dropLeadingEmpty xs      = xs
+
+-- | Returns the segments of the path component. E.g.,
+--    pathSegments <$> parseURI "http://example.org/foo/bar/baz";
+-- == ["foo", "bar", "baz"]
+pathSegments :: URI -> [String]
+pathSegments = segments . uriPath
+
+-- | Split last (name) segment from path, returning (path,name)
 splitLast :: String -> (String,String)
 splitLast p = (reverse revpath,reverse revname)
     where
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/network-uri-2.6.0.3/network-uri.cabal 
new/network-uri-2.6.1.0/network-uri.cabal
--- old/network-uri-2.6.0.3/network-uri.cabal   2015-05-03 23:07:21.000000000 
+0200
+++ new/network-uri-2.6.1.0/network-uri.cabal   2016-03-19 21:56:32.000000000 
+0100
@@ -1,8 +1,8 @@
 name:                network-uri
-version:             2.6.0.3
+version:             2.6.1.0
 synopsis:            URI manipulation
 description:
-  This package provides an URI manipulation inteface.
+  This package provides an URI manipulation interface.
   .
   In network-2.6 the @Network.URI@ module was split off from the
   network package into this package. If you're using the @Network.URI@
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/network-uri-2.6.0.3/tests/uri001.hs 
new/network-uri-2.6.1.0/tests/uri001.hs
--- old/network-uri-2.6.0.3/tests/uri001.hs     2015-05-03 23:07:21.000000000 
+0200
+++ new/network-uri-2.6.1.0/tests/uri001.hs     2016-03-19 21:56:32.000000000 
+0100
@@ -48,11 +48,13 @@
     , isUnescapedInURIComponent
     , isUnescapedInURI, escapeURIString, unEscapeString
     , normalizeCase, normalizeEscape, normalizePathSegments
+    , pathSegments
     )
 
 import Test.HUnit
 
 import Data.Maybe (fromJust)
+import Data.List (intercalate)
 import System.IO (openFile, IOMode(WriteMode), hClose)
 import qualified Test.Framework as TF
 import qualified Test.Framework.Providers.HUnit as TF
@@ -1259,6 +1261,48 @@
   , TF.testCase "testIsRelative04" $ testUriIsRelative "?what=that"
   ]
 
+testPathSegmentsRoundTrip :: URI -> Assertion
+testPathSegmentsRoundTrip u =
+  let segs = pathSegments u
+
+      dropSuffix _suf []              = []
+      dropSuffix suf [x] | suf == x   = []
+                         | otherwise = [x]
+      dropSuffix suf (x:xs)          = x : dropSuffix suf xs
+
+      dropPrefix _pre []                 = []
+      dropPrefix pre (x:xs) | pre == x   = xs
+                            | otherwise = (x:xs)
+      strippedUriPath = dropSuffix '/' $ dropPrefix '/' $ uriPath u
+  in
+     (Data.List.intercalate "/" segs @?= strippedUriPath)
+
+assertJust _f Nothing = assertFailure "URI failed to parse"
+assertJust f  (Just x) = f x
+
+testPathSegments = TF.testGroup "testPathSegments"
+  [ TF.testCase "testPathSegments03" $
+        assertJust testPathSegmentsRoundTrip $ parseURIReference ""
+  , TF.testCase "testPathSegments04" $
+        assertJust testPathSegmentsRoundTrip $ parseURIReference "/"
+  , TF.testCase "testPathSegments05" $
+        assertJust testPathSegmentsRoundTrip $ parseURIReference "//"
+  , TF.testCase "testPathSegments06" $
+        assertJust testPathSegmentsRoundTrip $ parseURIReference "foo//bar/"
+  , TF.testCase "testPathSegments07" $
+        assertJust testPathSegmentsRoundTrip $ parseURIReference "/foo//bar/"
+  , TF.testCase "testPathSegments03" $
+        assertJust testPathSegmentsRoundTrip $ parseURI "http://example.org";
+  , TF.testCase "testPathSegments04" $
+        assertJust testPathSegmentsRoundTrip $ parseURI "http://example.org/";
+  , TF.testCase "testPathSegments05" $
+        assertJust testPathSegmentsRoundTrip $ parseURI "http://example.org//";
+  , TF.testCase "testPathSegments06" $
+        assertJust testPathSegmentsRoundTrip $ parseURI 
"http://ex.ca/foo//bar/";
+  , TF.testCase "testPathSegments07" $
+        assertJust testPathSegmentsRoundTrip $ parseURI 
"http://ex.ca/foo//bar/";
+  ]
+
 -- Full test suite
 allTests =
   [ testURIRefSuite
@@ -1274,6 +1318,7 @@
   , testAltFn
   , testIsAbsolute
   , testIsRelative
+  , testPathSegments
   ]
 
 main = TF.defaultMain allTests


Reply via email to