[commit: ghc] master: Add test for #12788 (ec22bac)

git at git.haskell.org git at git.haskell.org
Thu Nov 3 18:05:36 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/ec22bacdd625b04d28228dd5522d59d0bc8b1152/ghc

>---------------------------------------------------------------

commit ec22bacdd625b04d28228dd5522d59d0bc8b1152
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Nov 3 14:01:54 2016 -0400

    Add test for #12788
    
    Commit bce99086e9f54909f51ff5a74cb8c666083bb021 (#12584) fixed #12788. Let's
    add a test to make sure it stays fixed.


>---------------------------------------------------------------

ec22bacdd625b04d28228dd5522d59d0bc8b1152
 testsuite/tests/th/T12788.hs     |  9 +++++++++
 testsuite/tests/th/T12788.stderr |  2 ++
 testsuite/tests/th/T12788_Lib.hs | 22 ++++++++++++++++++++++
 testsuite/tests/th/all.T         |  3 +++
 4 files changed, 36 insertions(+)

diff --git a/testsuite/tests/th/T12788.hs b/testsuite/tests/th/T12788.hs
new file mode 100644
index 0000000..dc13c4f
--- /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 0000000..485b200
--- /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 0000000..2924eef
--- /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 b2aee12..4f21121 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])



More information about the ghc-commits mailing list