Hello community,

here is the log from the commit of package ghc-tasty-th for openSUSE:Factory 
checked in at 2017-04-14 13:41:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-tasty-th (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-tasty-th.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-tasty-th"

Fri Apr 14 13:41:34 2017 rev:2 rq:487390 version:0.1.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-tasty-th/ghc-tasty-th.changes        
2017-02-03 17:40:11.147600323 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-tasty-th.new/ghc-tasty-th.changes   
2017-04-14 13:41:35.530564777 +0200
@@ -1,0 +2,5 @@
+Tue Apr  4 11:02:13 UTC 2017 - [email protected]
+
+- Update to version 0.1.5 with cabal2obs.
+
+-------------------------------------------------------------------

Old:
----
  tasty-th-0.1.4.tar.gz

New:
----
  tasty-th-0.1.5.tar.gz

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

Other differences:
------------------
++++++ ghc-tasty-th.spec ++++++
--- /var/tmp/diff_new_pack.3MHHll/_old  2017-04-14 13:41:36.214468118 +0200
+++ /var/tmp/diff_new_pack.3MHHll/_new  2017-04-14 13:41:36.218467553 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-tasty-th
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 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
@@ -18,20 +18,19 @@
 
 %global pkg_name tasty-th
 Name:           ghc-%{pkg_name}
-Version:        0.1.4
+Version:        0.1.5
 Release:        0
 Summary:        Automatic tasty test case discovery using TH
 License:        BSD-3-Clause
-Group:          System/Libraries
+Group:          Development/Languages/Other
 Url:            https://hackage.haskell.org/package/%{pkg_name}
 Source0:        
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
 BuildRequires:  ghc-Cabal-devel
+BuildRequires:  ghc-haskell-src-exts-devel
 BuildRequires:  ghc-rpm-macros
-# Begin cabal-rpm deps:
 BuildRequires:  ghc-tasty-devel
 BuildRequires:  ghc-template-haskell-devel
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-# End cabal-rpm deps
 
 %description
 Generate tasty TestTrees automatically with TemplateHaskell. See the README for
@@ -51,15 +50,12 @@
 %prep
 %setup -q -n %{pkg_name}-%{version}
 
-
 %build
 %ghc_lib_build
 
-
 %install
 %ghc_lib_install
 
-
 %post devel
 %ghc_pkg_recache
 

++++++ tasty-th-0.1.4.tar.gz -> tasty-th-0.1.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tasty-th-0.1.4/BSD3.txt new/tasty-th-0.1.5/BSD3.txt
--- old/tasty-th-0.1.4/BSD3.txt 2016-02-16 12:28:30.000000000 +0100
+++ new/tasty-th-0.1.5/BSD3.txt 2017-04-01 16:08:54.000000000 +0200
@@ -1,5 +1,5 @@
 Copyright (c) 2010, Oscar Finnsson
-Copyright (c) 2013-2016, Benno Fünfstück
+Copyright (c) 2013-2017, Benno Fünfstück
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tasty-th-0.1.4/src/Test/Tasty/TH.hs 
new/tasty-th-0.1.5/src/Test/Tasty/TH.hs
--- old/tasty-th-0.1.4/src/Test/Tasty/TH.hs     2016-02-16 12:28:30.000000000 
+0100
+++ new/tasty-th-0.1.5/src/Test/Tasty/TH.hs     2017-04-01 16:08:54.000000000 
+0200
@@ -29,6 +29,9 @@
 
 import Control.Monad (join)
 import Control.Applicative
+import Language.Haskell.Exts (parseFileContents)
+import Language.Haskell.Exts.Parser (ParseResult(..))
+import qualified Language.Haskell.Exts.Syntax as S
 import Language.Haskell.TH
 import Data.List
 import Data.Maybe
@@ -78,9 +81,23 @@
 extractTestFunctions :: FilePath -> IO [String]
 extractTestFunctions filePath = do
   file <- readFile filePath
-  let functions = map fst . concatMap lex . lines $ file
+  -- we first try to parse the file using haskell-src-exts
+  -- if that fails, we fallback to lexing each line, which is less
+  -- accurate but is more reliable (haskell-src-exts sometimes struggles
+  -- with less-common GHC extensions).
+  let functions = fromMaybe (lexed file) (parsed file)
       filtered pat = filter (pat `isPrefixOf`) functions
   return . nub $ concat [filtered "prop_", filtered "case_", filtered "test_"]
+ where
+  lexed = map fst . concatMap lex . lines
+  
+  parsed file = case parseFileContents file of
+    ParseOk parsedModule -> Just (declarations parsedModule)
+    ParseFailed _ _ -> Nothing
+  declarations (S.Module _ _ _ _ decls) = mapMaybe testFunName decls
+  declarations _ = []
+  testFunName (S.PatBind _ (S.PVar _ (S.Ident _ n)) _ _) = Just n
+  testFunName _ = Nothing
 
 -- | Extract the name of the current module.
 locationModule :: ExpQ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/tasty-th-0.1.4/tasty-th.cabal 
new/tasty-th-0.1.5/tasty-th.cabal
--- old/tasty-th-0.1.4/tasty-th.cabal   2016-02-16 12:28:30.000000000 +0100
+++ new/tasty-th-0.1.5/tasty-th.cabal   2017-04-01 16:08:54.000000000 +0200
@@ -1,5 +1,5 @@
 name: tasty-th
-version: 0.1.4
+version: 0.1.5
 cabal-version: >= 1.6
 build-type: Simple
 license: BSD3
@@ -14,7 +14,7 @@
 
 library
   exposed-modules: Test.Tasty.TH
-  build-depends: base >= 4 && < 5, tasty, template-haskell
+  build-depends: base >= 4 && < 5, haskell-src-exts >= 1.18.0, tasty, 
template-haskell
   hs-source-dirs: src
   other-extensions: TemplateHaskell
 


Reply via email to