summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorGeoffrey Mainland <gmainlan@microsoft.com>2011-09-30 17:23:09 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2011-09-30 17:46:38 +0100
commit0cbfe0b478a383de960a74934e65d6e5adb016e8 (patch)
tree555478eee754dd87b619c0006cef01e259191069 /testsuite
parent94e42024a7e8c9a16e64aeba95432d18892c4992 (diff)
downloadhaskell-0cbfe0b478a383de960a74934e65d6e5adb016e8.tar.gz
Add test case for #5204.
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/tests/quasiquotation/T5204.hs39
-rw-r--r--testsuite/tests/quasiquotation/T5204.stderr2
-rw-r--r--testsuite/tests/quasiquotation/all.T2
3 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/tests/quasiquotation/T5204.hs b/testsuite/tests/quasiquotation/T5204.hs
new file mode 100755
index 0000000000..00c976bc59
--- /dev/null
+++ b/testsuite/tests/quasiquotation/T5204.hs
@@ -0,0 +1,39 @@
+{-# LANGUAGE TypeSynonymInstances, TemplateHaskell, QuasiQuotes, MultiParamTypeClasses, FlexibleInstances, DeriveDataTypeable, NamedFieldPuns, ScopedTypeVariables #-}
+module Pnm where
+import qualified Data.Char as Char
+-- import Language.Pads.Padsc
+import Control.Monad
+
+_ws = one_or_more Char.isSpace
+ where one_or_more = undefined
+
+ws, wsnl, whitechar :: RE
+
+ws = REd "[ \t\n\r]+" " " -- whitespace
+wsnl = let REd wplus _ = ws in REd wplus "\n" -- whitespace output as \n
+whitechar = REd "[ \t\n\r]" "\n" -- one white character
+
+
+[pads|
+
+ data PGMx a = PGM "P5" ws Header whitechar (Pixmap a)
+
+ data Header = Header -- fields should be separated by whitespace
+ { width :: Int
+ ws , height :: Int
+ wsnl , constrain denominator :: Int
+ where <| 0 <= denominator && denominator < 65536 |>
+ }
+
+ data Pixmap a (h::Header) = Rows [Row a h | wsnl] length <| height h |>
+ data Row a (h::Header) = Pixels [a h | ws] length <| width h |>
+
+ newtype Greypix (h::Header) =
+ G constrain g::Int16 where <| 0 <= g && g <= denominator h |>
+
+ data PGM = PGMx Int16 Greypix
+
+]
+
+pgm file = do (rep, md) <- parseFile file
+ return rep
diff --git a/testsuite/tests/quasiquotation/T5204.stderr b/testsuite/tests/quasiquotation/T5204.stderr
new file mode 100644
index 0000000000..8f19d65cb2
--- /dev/null
+++ b/testsuite/tests/quasiquotation/T5204.stderr
@@ -0,0 +1,2 @@
+
+T5204.hs:17:7: unterminated quasiquotation at end of input
diff --git a/testsuite/tests/quasiquotation/all.T b/testsuite/tests/quasiquotation/all.T
index 2fa0427813..6193001ec4 100644
--- a/testsuite/tests/quasiquotation/all.T
+++ b/testsuite/tests/quasiquotation/all.T
@@ -5,3 +5,5 @@ test('T4150',
extra_clean(['T4150A.hi', 'T4150A.o', 'T4150.hi', 'T4150.o'])],
run_command,
['$MAKE -s --no-print-directory T4150'])
+test('T5204', [req_interp, only_compiler_types(['ghc'])],
+ compile_fail, [''])