Hello community,
here is the log from the commit of package ghc-neat-interpolation for
openSUSE:Leap:15.2 checked in at 2020-03-13 10:57:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/ghc-neat-interpolation (Old)
and /work/SRC/openSUSE:Leap:15.2/.ghc-neat-interpolation.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-neat-interpolation"
Fri Mar 13 10:57:15 2020 rev:12 rq:783495 version:0.5.1
Changes:
--------
---
/work/SRC/openSUSE:Leap:15.2/ghc-neat-interpolation/ghc-neat-interpolation.changes
2020-02-19 18:40:13.318117449 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.ghc-neat-interpolation.new.3160/ghc-neat-interpolation.changes
2020-03-13 10:57:15.200429467 +0100
@@ -1,0 +2,8 @@
+Fri Feb 7 08:04:12 UTC 2020 - [email protected]
+
+- Update neat-interpolation to version 0.5.1.
+ Upstream added a new change log file in this release. With no
+ previous version to compare against, the automatic updater cannot
+ reliable determine the relevante entries for this release.
+
+-------------------------------------------------------------------
Old:
----
neat-interpolation-0.3.2.5.tar.gz
New:
----
neat-interpolation-0.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-neat-interpolation.spec ++++++
--- /var/tmp/diff_new_pack.7UCoQI/_old 2020-03-13 10:57:15.584429740 +0100
+++ /var/tmp/diff_new_pack.7UCoQI/_new 2020-03-13 10:57:15.584429740 +0100
@@ -1,7 +1,7 @@
#
# spec file for package ghc-neat-interpolation
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 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,20 +19,24 @@
%global pkg_name neat-interpolation
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 0.3.2.5
+Version: 0.5.1
Release: 0
Summary: A quasiquoter for neat and simple multiline text interpolation
License: MIT
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-base-prelude-devel
BuildRequires: ghc-megaparsec-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-template-haskell-devel
BuildRequires: ghc-text-devel
%if %{with tests}
-BuildRequires: ghc-HTF-devel
+BuildRequires: ghc-QuickCheck-devel
+BuildRequires: ghc-quickcheck-instances-devel
+BuildRequires: ghc-rerebase-devel
+BuildRequires: ghc-tasty-devel
+BuildRequires: ghc-tasty-hunit-devel
+BuildRequires: ghc-tasty-quickcheck-devel
%endif
%description
@@ -73,5 +77,6 @@
%license LICENSE
%files devel -f %{name}-devel.files
+%doc CHANGELOG.md
%changelog
++++++ neat-interpolation-0.3.2.5.tar.gz -> neat-interpolation-0.5.1.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/neat-interpolation-0.3.2.5/CHANGELOG.md
new/neat-interpolation-0.5.1/CHANGELOG.md
--- old/neat-interpolation-0.3.2.5/CHANGELOG.md 1970-01-01 01:00:00.000000000
+0100
+++ new/neat-interpolation-0.5.1/CHANGELOG.md 2020-02-04 09:06:36.000000000
+0100
@@ -0,0 +1,7 @@
+## Version 0.5
+
+- Isolated the `trimming` and `untrimming` variations of quasi-quoter.
+
+## Version 0.4
+
+- Changed the behaviour of the quasi-quoter in regards to trailing whitespace.
Before it was always adding newline in the end, now it always completely
removes all the trailing whitespace.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/neat-interpolation-0.3.2.5/executables/APITests.hs
new/neat-interpolation-0.5.1/executables/APITests.hs
--- old/neat-interpolation-0.3.2.5/executables/APITests.hs 2019-12-03
12:25:37.000000000 +0100
+++ new/neat-interpolation-0.5.1/executables/APITests.hs 1970-01-01
01:00:00.000000000 +0100
@@ -1,49 +0,0 @@
-{-# OPTIONS_GHC -F -pgmF htfpp #-}
-
-import BasePrelude
-import Test.Framework
-import NeatInterpolation
-
-
-main = htfMain $ htf_thisModulesTests
-
-
-test_demo = do
- assertEqual
- "function(){\n function(){\n {\n indented line\n indented
line\n }\n }\n return {\n indented line\n indented line\n }\n}\n"
- (template a a)
- assertEqual
- "this_could_be_one_long_identifier\n"
- (escaped "one")
- where
- template a b =
- [text|
- function(){
- function(){
- $a
- }
- return $b
- }
- |]
- escaped name = [text|this_could_be_${name}_long_identifier|]
- a = "{\n indented line\n indented line\n}"
-
-test_dollar = do
- assertEqual
- "function(){\n function(){\n {\n indented line\n indented
line\n }\n }\n return \"$b\"\n}\n"
- (template a a)
- assertEqual
- "this_could_be_$one$_long_identifier\n"
- (escaped "one")
- where
- template a b =
- [text|
- function(){
- function(){
- $a
- }
- return "$$b"
- }
- |]
- escaped name = [text|this_could_be_$$${name}$$_long_identifier|]
- a = "{\n indented line\n indented line\n}"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/neat-interpolation-0.3.2.5/library/NeatInterpolation/Parsing.hs
new/neat-interpolation-0.5.1/library/NeatInterpolation/Parsing.hs
--- old/neat-interpolation-0.3.2.5/library/NeatInterpolation/Parsing.hs
2019-12-03 12:25:37.000000000 +0100
+++ new/neat-interpolation-0.5.1/library/NeatInterpolation/Parsing.hs
2020-02-04 09:06:36.000000000 +0100
@@ -1,6 +1,6 @@
module NeatInterpolation.Parsing where
-import BasePrelude hiding (many, some, try, (<|>))
+import NeatInterpolation.Prelude hiding (many, some, try, (<|>))
import Data.Text (Text, pack)
import Text.Megaparsec hiding (Line)
import Text.Megaparsec.Char
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/neat-interpolation-0.3.2.5/library/NeatInterpolation/Prelude.hs
new/neat-interpolation-0.5.1/library/NeatInterpolation/Prelude.hs
--- old/neat-interpolation-0.3.2.5/library/NeatInterpolation/Prelude.hs
1970-01-01 01:00:00.000000000 +0100
+++ new/neat-interpolation-0.5.1/library/NeatInterpolation/Prelude.hs
2020-02-04 09:06:36.000000000 +0100
@@ -0,0 +1,78 @@
+module NeatInterpolation.Prelude
+(
+ module Exports,
+)
+where
+
+-- base
+-------------------------
+import Control.Applicative as Exports
+import Control.Arrow as Exports hiding (first, second)
+import Control.Category as Exports
+import Control.Concurrent as Exports
+import Control.Exception as Exports
+import Control.Monad as Exports hiding (fail, mapM_, sequence_, forM_, msum,
mapM, sequence, forM)
+import Control.Monad.IO.Class as Exports
+import Control.Monad.Fail as Exports
+import Control.Monad.Fix as Exports hiding (fix)
+import Control.Monad.ST as Exports
+import Data.Bifunctor as Exports
+import Data.Bits as Exports
+import Data.Bool as Exports
+import Data.Char as Exports
+import Data.Coerce as Exports
+import Data.Complex as Exports
+import Data.Data as Exports
+import Data.Dynamic as Exports
+import Data.Either as Exports
+import Data.Fixed as Exports
+import Data.Foldable as Exports hiding (toList)
+import Data.Function as Exports hiding (id, (.))
+import Data.Functor as Exports
+import Data.Functor.Identity as Exports
+import Data.Int as Exports
+import Data.IORef as Exports
+import Data.Ix as Exports
+import Data.List as Exports hiding (sortOn, isSubsequenceOf, uncons, concat,
foldr, foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem,
foldl, foldr1, notElem, or, find, maximumBy, minimumBy, mapAccumL, mapAccumR,
foldl')
+import Data.Maybe as Exports
+import Data.Monoid as Exports hiding (Last(..), First(..), (<>))
+import Data.Ord as Exports
+import Data.Proxy as Exports
+import Data.Ratio as Exports
+import Data.Semigroup as Exports
+import Data.STRef as Exports
+import Data.String as Exports
+import Data.Traversable as Exports
+import Data.Tuple as Exports
+import Data.Unique as Exports
+import Data.Version as Exports
+import Data.Void as Exports
+import Data.Word as Exports
+import Debug.Trace as Exports
+import Foreign.ForeignPtr as Exports
+import Foreign.Ptr as Exports
+import Foreign.StablePtr as Exports
+import Foreign.Storable as Exports hiding (sizeOf, alignment)
+import GHC.Conc as Exports hiding (withMVar, threadWaitWriteSTM,
threadWaitWrite, threadWaitReadSTM, threadWaitRead)
+import GHC.Exts as Exports (lazy, inline, sortWith, groupWith, IsList(..))
+import GHC.Generics as Exports (Generic, Generic1)
+import GHC.IO.Exception as Exports
+import Numeric as Exports
+import Prelude as Exports hiding (fail, concat, foldr, mapM_, sequence_,
foldl1, maximum, minimum, product, sum, all, and, any, concatMap, elem, foldl,
foldr1, notElem, or, mapM, sequence, id, (.))
+import System.Environment as Exports
+import System.Exit as Exports
+import System.IO as Exports
+import System.IO.Error as Exports
+import System.IO.Unsafe as Exports
+import System.Mem as Exports
+import System.Mem.StableName as Exports
+import System.Timeout as Exports
+import Text.ParserCombinators.ReadP as Exports (ReadP, ReadS, readP_to_S,
readS_to_P)
+import Text.ParserCombinators.ReadPrec as Exports (ReadPrec, readPrec_to_P,
readP_to_Prec, readPrec_to_S, readS_to_Prec)
+import Text.Printf as Exports (printf, hPrintf)
+import Text.Read as Exports (Read(..), readMaybe, readEither)
+import Unsafe.Coerce as Exports
+
+-- text
+-------------------------
+import Data.Text as Exports (Text)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/neat-interpolation-0.3.2.5/library/NeatInterpolation/String.hs
new/neat-interpolation-0.5.1/library/NeatInterpolation/String.hs
--- old/neat-interpolation-0.3.2.5/library/NeatInterpolation/String.hs
2019-12-03 12:25:37.000000000 +0100
+++ new/neat-interpolation-0.5.1/library/NeatInterpolation/String.hs
2020-02-04 09:06:36.000000000 +0100
@@ -1,23 +1,20 @@
module NeatInterpolation.String where
-import BasePrelude
+import NeatInterpolation.Prelude
-normalizeQQInput :: [Char] -> [Char]
-normalizeQQInput = trim . unindent' . tabsToSpaces
- where
- unindent' :: [Char] -> [Char]
- unindent' s =
- case lines s of
- head:tail ->
- let
- unindentedHead = dropWhile (== ' ') head
- minimumTailIndent = minimumIndent . unlines $ tail
- unindentedTail = case minimumTailIndent of
- Just indent -> map (drop indent) tail
- Nothing -> tail
- in unlines $ unindentedHead : unindentedTail
- [] -> []
+unindent :: [Char] -> [Char]
+unindent s =
+ case lines s of
+ head : tail ->
+ let
+ unindentedHead = dropWhile (== ' ') head
+ minimumTailIndent = minimumIndent . unlines $ tail
+ unindentedTail = case minimumTailIndent of
+ Just indent -> map (drop indent) tail
+ Nothing -> tail
+ in unlines $ unindentedHead : unindentedTail
+ [] -> []
trim :: [Char] -> [Char]
trim = dropWhileRev isSpace . dropWhile isSpace
@@ -25,15 +22,9 @@
dropWhileRev :: (a -> Bool) -> [a] -> [a]
dropWhileRev p = foldr (\x xs -> if p x && null xs then [] else x:xs) []
-unindent :: [Char] -> [Char]
-unindent s =
- case minimumIndent s of
- Just indent -> unlines . map (drop indent) . lines $ s
- Nothing -> s
-
tabsToSpaces :: [Char] -> [Char]
-tabsToSpaces ('\t':tail) = " " ++ tabsToSpaces tail
-tabsToSpaces (head:tail) = head : tabsToSpaces tail
+tabsToSpaces ('\t' : tail) = " " ++ tabsToSpaces tail
+tabsToSpaces (head : tail) = head : tabsToSpaces tail
tabsToSpaces [] = []
minimumIndent :: [Char] -> Maybe Int
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/neat-interpolation-0.3.2.5/library/NeatInterpolation.hs
new/neat-interpolation-0.5.1/library/NeatInterpolation.hs
--- old/neat-interpolation-0.3.2.5/library/NeatInterpolation.hs 2019-12-03
12:25:37.000000000 +0100
+++ new/neat-interpolation-0.5.1/library/NeatInterpolation.hs 2020-02-04
09:06:36.000000000 +0100
@@ -1,130 +1,142 @@
-{-# OPTIONS_GHC -fno-warn-missing-fields #-}
--- |
--- NeatInterpolation provides a quasiquoter for producing strings
--- with a simple interpolation of input values.
--- It removes the excessive indentation from the input and
--- accurately manages the indentation of all lines of interpolated variables.
--- But enough words, the code shows it better.
---
--- Consider the following declaration:
---
--- > {-# LANGUAGE QuasiQuotes #-}
--- >
--- > import NeatInterpolation
--- > import Data.Text (Text)
--- >
--- > f :: Text -> Text -> Text
--- > f a b =
--- > [text|
--- > function(){
--- > function(){
--- > $a
--- > }
--- > return $b
--- > }
--- > |]
---
--- Executing the following:
---
--- > main = T.putStrLn $ f "1" "2"
---
--- will produce this (notice the reduced indentation compared to how it was
--- declared):
---
--- > function(){
--- > function(){
--- > 1
--- > }
--- > return 2
--- > }
---
--- Now let's test it with multiline string parameters:
---
--- > main = T.putStrLn $ f
--- > "{\n indented line\n indented line\n}"
--- > "{\n indented line\n indented line\n}"
---
--- We get
---
--- > function(){
--- > function(){
--- > {
--- > indented line
--- > indented line
--- > }
--- > }
--- > return {
--- > indented line
--- > indented line
--- > }
--- > }
---
--- See how it neatly preserved the indentation levels of lines the
--- variable placeholders were at?
---
--- If you need to separate variable placeholder from the following text to
--- prevent treating the rest of line as variable name, use escaped variable:
---
--- > f name = [text|this_could_be_${name}_long_identifier|]
---
--- So
---
--- > f "one" == "this_could_be_one_long_identifier"
---
--- If you want to write something that looks like a variable but should be
--- inserted as-is, escape it with another @$@:
---
--- > f word = [text|$$my ${word} $${string}|]
---
--- results in
---
--- > f "funny" == "$my funny ${string}|]
-module NeatInterpolation (text) where
-
-import BasePrelude
+{-|
+NeatInterpolation provides a quasiquoter for producing strings
+with a simple interpolation of input values.
+It removes the excessive indentation from the input and
+accurately manages the indentation of all lines of interpolated variables.
+But enough words, the code shows it better.
+
+Consider the following declaration:
+
+> {-# LANGUAGE QuasiQuotes #-}
+>
+> import NeatInterpolation
+> import Data.Text (Text)
+>
+> f :: Text -> Text -> Text
+> f a b =
+> [trimming|
+> function(){
+> function(){
+> $a
+> }
+> return $b
+> }
+> |]
+
+Executing the following:
+
+> main = Text.putStrLn $ f "1" "2"
+
+will produce this (notice the reduced indentation compared to how it was
+declared):
+
+> function(){
+> function(){
+> 1
+> }
+> return 2
+> }
+
+Now let's test it with multiline string parameters:
+
+> main = Text.putStrLn $ f
+> "{\n indented line\n indented line\n}"
+> "{\n indented line\n indented line\n}"
+
+We get
+
+> function(){
+> function(){
+> {
+> indented line
+> indented line
+> }
+> }
+> return {
+> indented line
+> indented line
+> }
+> }
+
+See how it neatly preserved the indentation levels of lines the
+variable placeholders were at?
+
+If you need to separate variable placeholder from the following text to
+prevent treating the rest of line as variable name, use escaped variable:
+
+> f name = [trimming|this_could_be_${name}_long_identifier|]
+
+So
+
+> f "one" == "this_could_be_one_long_identifier"
+
+If you want to write something that looks like a variable but should be
+inserted as-is, escape it with another @$@:
+
+> f word = [trimming|$$my ${word} $${string}|]
+
+results in
+
+> f "funny" == "$my funny ${string}"
+-}
+module NeatInterpolation (trimming, untrimming, text) where
+import NeatInterpolation.Prelude
import Language.Haskell.TH
-import Language.Haskell.TH.Quote
-
-import NeatInterpolation.String
-import NeatInterpolation.Parsing
-
-import Data.Text (Text)
-import qualified Data.Text as T
+import Language.Haskell.TH.Quote hiding (quoteExp)
+import qualified Data.Text as Text
+import qualified NeatInterpolation.String as String
+import qualified NeatInterpolation.Parsing as Parsing
--- |
--- The quasiquoter.
+expQQ quoteExp = QuasiQuoter quoteExp notSupported notSupported notSupported
where
+ notSupported _ = fail "Quotation in this context is not supported"
+
+{-|
+An alias to `trimming` for backward-compatibility.
+-}
text :: QuasiQuoter
-text = QuasiQuoter {quoteExp = quoteExprExp}
+text = trimming
+
+{-|
+Trimmed quasiquoter variation.
+Same as `untrimming`, but also
+removes the leading and trailing whitespace.
+-}
+trimming :: QuasiQuoter
+trimming = expQQ (quoteExp . String.trim . String.unindent .
String.tabsToSpaces)
+
+{-|
+Untrimmed quasiquoter variation.
+Unindents the quoted template and converts tabs to spaces.
+-}
+untrimming :: QuasiQuoter
+untrimming = expQQ (quoteExp . String.unindent . String.tabsToSpaces)
--- |
--- A function used internally by the quasiquoter. Just ignore it.
indentQQPlaceholder :: Int -> Text -> Text
-indentQQPlaceholder indent text = case T.lines text of
- head:tail -> T.intercalate (T.pack "\n") $
- head : map (T.replicate indent (T.singleton ' ') <>) tail
+indentQQPlaceholder indent text = case Text.lines text of
+ head:tail -> Text.intercalate (Text.singleton '\n') $
+ head : map (Text.replicate indent (Text.singleton ' ') <>) tail
[] -> text
-
-quoteExprExp :: String -> Q Exp
-quoteExprExp input =
- case parseLines $ normalizeQQInput input of
+quoteExp :: String -> Q Exp
+quoteExp input =
+ case Parsing.parseLines input of
Left e -> fail $ show e
- Right lines -> sigE (appE [|T.unlines|] $ listE $ map lineExp lines)
+ Right lines -> sigE (appE [|Text.intercalate "\n"|] $ listE $ map lineExp
lines)
[t|Text|]
-lineExp :: Line -> Q Exp
-lineExp (Line indent contents) =
+lineExp :: Parsing.Line -> Q Exp
+lineExp (Parsing.Line indent contents) =
case contents of
- [] -> [| T.empty |]
+ [] -> [| Text.empty |]
[x] -> toExp x
- xs -> appE [|T.concat|] $ listE $ map toExp xs
+ xs -> appE [|Text.concat|] $ listE $ map toExp xs
where toExp = contentExp (fromIntegral indent)
-contentExp :: Integer -> LineContent -> Q Exp
-contentExp _ (LineContentText text) = appE [|T.pack|] (stringE text)
-contentExp indent (LineContentIdentifier name) = do
+contentExp :: Integer -> Parsing.LineContent -> Q Exp
+contentExp _ (Parsing.LineContentText text) = appE [|Text.pack|] (stringE text)
+contentExp indent (Parsing.LineContentIdentifier name) = do
valueName <- lookupValueName name
case valueName of
Just valueName -> do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/neat-interpolation-0.3.2.5/neat-interpolation.cabal
new/neat-interpolation-0.5.1/neat-interpolation.cabal
--- old/neat-interpolation-0.3.2.5/neat-interpolation.cabal 2019-12-03
12:25:37.000000000 +0100
+++ new/neat-interpolation-0.5.1/neat-interpolation.cabal 2020-02-04
09:06:36.000000000 +0100
@@ -1,77 +1,54 @@
-name:
- neat-interpolation
-version:
- 0.3.2.5
-synopsis:
- A quasiquoter for neat and simple multiline text interpolation
+name: neat-interpolation
+version: 0.5.1
+synopsis: A quasiquoter for neat and simple multiline text interpolation
description:
A quasiquoter for producing Text values with support for
a simple interpolation of input values.
It removes the excessive indentation from the input and
accurately manages the indentation of all lines of the interpolated
variables.
-category:
- String, QuasiQuotes
-license:
- MIT
-license-file:
- LICENSE
-copyright:
- (c) 2013, Nikita Volkov
-author:
- Nikita Volkov <[email protected]>
-maintainer:
- Nikita Volkov <[email protected]>
-homepage:
- https://github.com/nikita-volkov/neat-interpolation
-bug-reports:
- https://github.com/nikita-volkov/neat-interpolation/issues
-build-type:
- Simple
-cabal-version:
- >=1.10
-
+category: String, QuasiQuotes
+license: MIT
+license-file: LICENSE
+copyright: (c) 2013, Nikita Volkov
+author: Nikita Volkov <[email protected]>
+maintainer: Nikita Volkov <[email protected]>
+homepage: https://github.com/nikita-volkov/neat-interpolation
+bug-reports: https://github.com/nikita-volkov/neat-interpolation/issues
+build-type: Simple
+cabal-version: >=1.10
+extra-source-files: CHANGELOG.md
source-repository head
- type:
- git
- location:
- git://github.com/nikita-volkov/neat-interpolation.git
-
+ type: git
+ location: git://github.com/nikita-volkov/neat-interpolation.git
library
- hs-source-dirs:
- library
+ hs-source-dirs: library
+ default-extensions: BangPatterns, BinaryLiterals, ConstraintKinds,
DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable,
DeriveFunctor, DeriveGeneric, DeriveTraversable, DuplicateRecordFields,
EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies,
GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash,
MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude,
NoMonomorphismRestriction, OverloadedLists, OverloadedStrings, PatternGuards,
PatternSynonyms, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards,
ScopedTypeVariables, StandaloneDeriving, StrictData, TemplateHaskell,
TupleSections, TypeApplications, TypeFamilies, TypeOperators, UnboxedTuples
+ default-language: Haskell2010
exposed-modules:
NeatInterpolation
other-modules:
NeatInterpolation.Parsing
+ NeatInterpolation.Prelude
NeatInterpolation.String
build-depends:
- text == 1.*,
- megaparsec >= 7 && < 9,
- template-haskell >= 2.8 && < 3,
- base-prelude < 2,
- base >= 4.9 && < 5
- ghc-options:
- -funbox-strict-fields
- default-extensions:
- Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures,
DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls,
FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs,
GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash,
MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude,
NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp,
QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables,
StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies,
TypeOperators, UnboxedTuples
- default-language:
- Haskell2010
-
-
-test-suite api-tests
- type:
- exitcode-stdio-1.0
- hs-source-dirs:
- executables
- main-is:
- APITests.hs
+ base >=4.9 && <5,
+ megaparsec >=7 && <9,
+ template-haskell >=2.8 && <3,
+ text ==1.*
+
+test-suite test
+ type: exitcode-stdio-1.0
+ hs-source-dirs: test
+ default-extensions: BangPatterns, BinaryLiterals, ConstraintKinds,
DataKinds, DefaultSignatures, DeriveDataTypeable, DeriveFoldable,
DeriveFunctor, DeriveGeneric, DeriveTraversable, DuplicateRecordFields,
EmptyDataDecls, FlexibleContexts, FlexibleInstances, FunctionalDependencies,
GADTs, GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash,
MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude,
NoMonomorphismRestriction, OverloadedLists, OverloadedStrings, PatternGuards,
PatternSynonyms, ParallelListComp, QuasiQuotes, RankNTypes, RecordWildCards,
ScopedTypeVariables, StandaloneDeriving, StrictData, TemplateHaskell,
TupleSections, TypeApplications, TypeFamilies, TypeOperators, UnboxedTuples
+ default-language: Haskell2010
+ main-is: Main.hs
build-depends:
neat-interpolation,
- HTF >= 0.11 && < 0.14,
- base-prelude
- default-extensions:
- Arrows, BangPatterns, ConstraintKinds, DataKinds, DefaultSignatures,
DeriveDataTypeable, DeriveFunctor, DeriveGeneric, EmptyDataDecls,
FlexibleContexts, FlexibleInstances, FunctionalDependencies, GADTs,
GeneralizedNewtypeDeriving, LambdaCase, LiberalTypeSynonyms, MagicHash,
MultiParamTypeClasses, MultiWayIf, NoImplicitPrelude,
NoMonomorphismRestriction, OverloadedStrings, PatternGuards, ParallelListComp,
QuasiQuotes, RankNTypes, RecordWildCards, ScopedTypeVariables,
StandaloneDeriving, TemplateHaskell, TupleSections, TypeFamilies,
TypeOperators, UnboxedTuples
- default-language:
- Haskell2010
+ QuickCheck >=2.13 && <3,
+ quickcheck-instances >=0.3.22 && <0.4,
+ rerebase <2,
+ tasty >=1.2.3 && <2,
+ tasty-hunit >=0.10.0.2 && <0.11,
+ tasty-quickcheck >=0.10.1 && <0.11
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/neat-interpolation-0.3.2.5/test/Main.hs
new/neat-interpolation-0.5.1/test/Main.hs
--- old/neat-interpolation-0.3.2.5/test/Main.hs 1970-01-01 01:00:00.000000000
+0100
+++ new/neat-interpolation-0.5.1/test/Main.hs 2020-02-04 09:06:36.000000000
+0100
@@ -0,0 +1,66 @@
+module Main where
+
+import Prelude hiding (choose)
+import Test.QuickCheck.Instances
+import Test.Tasty
+import Test.Tasty.Runners
+import Test.Tasty.HUnit
+import Test.Tasty.QuickCheck
+import NeatInterpolation
+import qualified Test.QuickCheck as QuickCheck
+import qualified Test.QuickCheck.Property as QuickCheck
+
+
+main = defaultMain $ testGroup "" $
+ [
+ testCase "Demo" $ let
+ template a b =
+ [trimming|
+ function(){
+ function(){
+ $a
+ }
+ return $b
+ }
+ |]
+ a = "{\n indented line\n indented line\n}"
+ in assertEqual ""
+ "function(){\n function(){\n {\n indented line\n
indented line\n }\n }\n return {\n indented line\n indented line\n
}\n}"
+ (template a a)
+ ,
+ testCase "Isolation" $ let
+ isolated name = [trimming|this_could_be_${name}_long_identifier|]
+ in assertEqual ""
+ "this_could_be_one_long_identifier"
+ (isolated "one")
+ ,
+ testCase "Escaping 1" $ let
+ template a b =
+ [trimming|
+ function(){
+ function(){
+ $a
+ }
+ return "$$b"
+ }
+ |]
+ a = "{\n indented line\n indented line\n}"
+ in assertEqual ""
+ "function(){\n function(){\n {\n indented line\n
indented line\n }\n }\n return \"$b\"\n}"
+ (template a a)
+ ,
+ testCase "Escaping 2" $ let
+ escaped name = [trimming|this_could_be_$$${name}$$_long_identifier|]
+ in assertEqual ""
+ "this_could_be_$one$_long_identifier"
+ (escaped "one")
+ ,
+ testCase "Deindentation" $ let
+ template fieldName className = [trimming|
+ * @param $fieldName value of the {@code $fieldName} property of
+ the {@code $className} case
+ |]
+ in assertEqual ""
+ "* @param a value of the {@code a} property of\n the {@code
b} case"
+ (template "a" "b")
+ ]