Add test for incompatible flags (issue #11580)
authorKai Harries <kai.harries@gmail.com>
Sun, 20 Mar 2016 16:51:39 +0000 (17:51 +0100)
committerBen Gamari <ben@smart-cactus.org>
Sun, 20 Mar 2016 21:00:37 +0000 (22:00 +0100)
Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2013

GHC Trac Issues: #11580

testsuite/tests/safeHaskell/flags/SafeFlags30.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/flags/SafeFlags30.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/flags/all.T

diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags30.hs b/testsuite/tests/safeHaskell/flags/SafeFlags30.hs
new file mode 100644 (file)
index 0000000..27790a4
--- /dev/null
@@ -0,0 +1,7 @@
+{-# LANGUAGE Safe, Unsafe, Trustworthy #-}
+-- | Basic test to see that incompatible flags give a nice error
+-- message and ghc do not panic (see issue #11580).
+module SafeFlags30 where
+
+f :: Int
+f = 1
diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags30.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags30.stderr
new file mode 100644 (file)
index 0000000..11ff3a6
--- /dev/null
@@ -0,0 +1,3 @@
+ghc: SafeFlags30.hs:1:20-25: Incompatible Safe Haskell flags! (Safe, Unsafe)
+SafeFlags30.hs:1:28-38: Incompatible Safe Haskell flags! (Safe, Trustworthy)
+Usage: For basic information, try the `--help' option.
index fff8841..0fa30e5 100644 (file)
@@ -62,3 +62,4 @@ test('SafeFlags29', normal, compile_fail, [''])
 test('Flags01', normal, compile, ['-XSafe'])
 test('Flags02', normal, compile, ['-XSafe'])
 
+test('SafeFlags30', normal, compile_fail, [''])