summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2016-11-03 14:01:54 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2016-11-03 14:01:54 -0400
commitec22bacdd625b04d28228dd5522d59d0bc8b1152 (patch)
tree30aaa1c604213ae77009b142a3955beacf111256 /testsuite
parenteaa348238bc6ea6a553240334602647ee48f8cf5 (diff)
downloadhaskell-ec22bacdd625b04d28228dd5522d59d0bc8b1152.tar.gz
Add test for #12788
Commit bce99086e9f54909f51ff5a74cb8c666083bb021 (#12584) fixed #12788. Let's add a test to make sure it stays fixed.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/th/T12788.hs9
-rw-r--r--testsuite/tests/th/T12788.stderr2
-rw-r--r--testsuite/tests/th/T12788_Lib.hs22
-rw-r--r--testsuite/tests/th/all.T3
4 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/tests/th/T12788.hs b/testsuite/tests/th/T12788.hs
new file mode 100644
index 0000000000..dc13c4f9a1
--- /dev/null
+++ b/testsuite/tests/th/T12788.hs
@@ -0,0 +1,9 @@
+{-# LANGUAGE TemplateHaskell #-}
+module T12788 where
+
+import Language.Haskell.TH
+import T12788_Lib
+
+data Bad = Bad { _bad :: String } deriving (Eq, Ord, Show)
+
+$(deriveJSON defaultOptions{} ''Bad)
diff --git a/testsuite/tests/th/T12788.stderr b/testsuite/tests/th/T12788.stderr
new file mode 100644
index 0000000000..485b2005f9
--- /dev/null
+++ b/testsuite/tests/th/T12788.stderr
@@ -0,0 +1,2 @@
+
+T12788.hs:9:14: error: Empty record update
diff --git a/testsuite/tests/th/T12788_Lib.hs b/testsuite/tests/th/T12788_Lib.hs
new file mode 100644
index 0000000000..2924eef5fb
--- /dev/null
+++ b/testsuite/tests/th/T12788_Lib.hs
@@ -0,0 +1,22 @@
+module T12788_Lib where
+
+import Language.Haskell.TH
+
+data Options = Options
+ { fieldLabelModifier :: String -> String
+ , constructorTagModifier :: String -> String
+ , allNullaryToStringTag :: Bool
+ , omitNothingFields :: Bool
+ , sumEncoding :: SumEncoding
+ , unwrapUnaryRecords :: Bool
+ }
+
+data SumEncoding =
+ TaggedObject { tagFieldName :: String
+ , contentsFieldName :: String
+ }
+ | ObjectWithSingleField
+ | TwoElemArray
+
+deriveJSON :: Options -> Name -> Q [Dec]
+deriveJSON _ _ = return []
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index b2aee12ad1..4f21121f9a 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -433,3 +433,6 @@ test('T12478_3', omit_ways(['ghci']), compile, ['-v0'])
test('T12478_4', omit_ways(['ghci']), compile_fail, ['-v0'])
test('T12513', omit_ways(['ghci']), compile_fail, ['-v0'])
test('T12530', normal, compile, ['-v0 -ddump-splices -dsuppress-uniques'])
+test('T12788', extra_clean(['T12788_Lib.hi', 'T12788_Lib.o']),
+ multimod_compile_fail,
+ ['T12788.hs', '-v0 ' + config.ghc_th_way_flags])