neat-interpolation 0.5.0.1 → 0.5.1
raw patch · 3 files changed
+23/−7 lines, 3 files
Files
- library/NeatInterpolation.hs +7/−1
- neat-interpolation.cabal +1/−1
- test/Main.hs +15/−5
library/NeatInterpolation.hs view
@@ -79,7 +79,7 @@ > f "funny" == "$my funny ${string}" -}-module NeatInterpolation (trimming, untrimming) where+module NeatInterpolation (trimming, untrimming, text) where import NeatInterpolation.Prelude import Language.Haskell.TH@@ -91,6 +91,12 @@ 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 = trimming {-| Trimmed quasiquoter variation.
neat-interpolation.cabal view
@@ -1,5 +1,5 @@ name: neat-interpolation-version: 0.5.0.1+version: 0.5.1 synopsis: A quasiquoter for neat and simple multiline text interpolation description: A quasiquoter for producing Text values with support for
test/Main.hs view
@@ -34,7 +34,7 @@ "this_could_be_one_long_identifier" (isolated "one") ,- testCase "Escaping" $ let+ testCase "Escaping 1" $ let template a b = [trimming| function(){@@ -44,13 +44,23 @@ return "$$b" } |]- escaped name = [trimming|this_could_be_$$${name}$$_long_identifier|] a = "{\n indented line\n indented line\n}"- in do- assertEqual ""+ in assertEqual "" "function(){\n function(){\n {\n indented line\n indented line\n }\n }\n return \"$b\"\n}" (template a a)- assertEqual ""+ ,+ 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") ]