Add test for 'distrust-all-packages' flag
authorDavid Terei <davidterei@gmail.com>
Thu, 9 Feb 2012 00:19:32 +0000 (16:19 -0800)
committerDavid Terei <davidterei@gmail.com>
Thu, 9 Feb 2012 00:19:32 +0000 (16:19 -0800)
testsuite/tests/safeHaskell/check/Check09.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/check/Check09.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/check/Check10.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/check/all.T

diff --git a/testsuite/tests/safeHaskell/check/Check09.hs b/testsuite/tests/safeHaskell/check/Check09.hs
new file mode 100644 (file)
index 0000000..9d4d03c
--- /dev/null
@@ -0,0 +1,8 @@
+{-# LANGUAGE Safe #-}
+module Check09 where
+
+import Data.ByteString.Char8
+
+b :: ByteString
+b = pack "Hello World"
+
diff --git a/testsuite/tests/safeHaskell/check/Check09.stderr b/testsuite/tests/safeHaskell/check/Check09.stderr
new file mode 100644 (file)
index 0000000..ae3f836
--- /dev/null
@@ -0,0 +1,3 @@
+
+Check09.hs:4:1:
+    bytestring-0.9.2.0:Data.ByteString.Char8 can't be safely imported! The package (bytestring-0.9.2.0) the module resides in isn't trusted.
diff --git a/testsuite/tests/safeHaskell/check/Check10.hs b/testsuite/tests/safeHaskell/check/Check10.hs
new file mode 100644 (file)
index 0000000..21fad6a
--- /dev/null
@@ -0,0 +1,8 @@
+{-# LANGUAGE Safe #-}
+module Check10 where
+
+import Data.ByteString.Char8
+
+b :: ByteString
+b = pack "Hello World"
+
index 41d8edf..4cef8f8 100644 (file)
@@ -57,3 +57,10 @@ test('Check08',
      extra_clean(['Check08_A.hi', 'Check08_A.o', 'Check08_B.hi', 'Check08_B.o']),
      multimod_compile_fail, ['Check08', ''])
 
+# check -distrust-all-packages flag works
+test('Check09', normal, compile_fail, ['-fpackage-trust -distrust-all-packages'])
+
+# as above but trust this time
+test('Check10', normal, compile,
+     ['-fpackage-trust -distrust-all-packages -trust bytestring -trust base'])
+