Add some tests for ghci under -XSafe
authorDavid Terei <davidterei@gmail.com>
Fri, 10 Feb 2012 19:40:26 +0000 (11:40 -0800)
committerDavid Terei <davidterei@gmail.com>
Fri, 10 Feb 2012 19:40:26 +0000 (11:40 -0800)
47 files changed:
testsuite/tests/safeHaskell/ghci/A.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/B.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/C.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/D.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/E.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/Makefile [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/P13_A.hs [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/all.T [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p1.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p1.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p10.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p10.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p11.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p11.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p12.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p12.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p13.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p13.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p13.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p14.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p14.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p15.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p15.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p15.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p16.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p16.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p16.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p2.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p2.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p2.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p3.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p3.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p3.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p4.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p4.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p5.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p5.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p6.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p6.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p6.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p7.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p7.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p8.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p8.stdout [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p9.script [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p9.stderr [new file with mode: 0644]
testsuite/tests/safeHaskell/ghci/p9.stdout [new file with mode: 0644]

diff --git a/testsuite/tests/safeHaskell/ghci/A.hs b/testsuite/tests/safeHaskell/ghci/A.hs
new file mode 100644 (file)
index 0000000..73da27f
--- /dev/null
@@ -0,0 +1,10 @@
+{-# LANGUAGE Trustworthy #-}
+module A (a) where
+
+import System.IO.Unsafe
+
+a :: Int
+a = 1
+
+unsafe = unsafePerformIO
+
diff --git a/testsuite/tests/safeHaskell/ghci/B.hs b/testsuite/tests/safeHaskell/ghci/B.hs
new file mode 100644 (file)
index 0000000..58ecfb4
--- /dev/null
@@ -0,0 +1,8 @@
+{-# LANGUAGE Unsafe #-}
+module B where
+
+import System.IO.Unsafe
+
+a :: Int
+a = 1
+
diff --git a/testsuite/tests/safeHaskell/ghci/C.hs b/testsuite/tests/safeHaskell/ghci/C.hs
new file mode 100644 (file)
index 0000000..94959c7
--- /dev/null
@@ -0,0 +1,13 @@
+{-# LANGUAGE Safe #-}
+module C (a, C(), D(..)) where
+
+a :: Int
+a = 1
+
+b :: Int
+b = 2
+
+data C a = C a Int
+
+data D a = D a Int
+
diff --git a/testsuite/tests/safeHaskell/ghci/D.hs b/testsuite/tests/safeHaskell/ghci/D.hs
new file mode 100644 (file)
index 0000000..3e455fa
--- /dev/null
@@ -0,0 +1,8 @@
+module D where
+
+a :: Int
+a = 1
+
+b :: Int
+b = 2
+
diff --git a/testsuite/tests/safeHaskell/ghci/E.hs b/testsuite/tests/safeHaskell/ghci/E.hs
new file mode 100644 (file)
index 0000000..4474d46
--- /dev/null
@@ -0,0 +1,7 @@
+module E where
+
+import System.IO.Unsafe
+
+a :: Int
+a = 1
+
diff --git a/testsuite/tests/safeHaskell/ghci/Makefile b/testsuite/tests/safeHaskell/ghci/Makefile
new file mode 100644 (file)
index 0000000..4a26853
--- /dev/null
@@ -0,0 +1,4 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
diff --git a/testsuite/tests/safeHaskell/ghci/P13_A.hs b/testsuite/tests/safeHaskell/ghci/P13_A.hs
new file mode 100644 (file)
index 0000000..1044c83
--- /dev/null
@@ -0,0 +1,9 @@
+{-# LANGUAGE OverlappingInstances, FlexibleInstances #-}
+module P13_A where
+
+class Pos a where { res :: a -> Bool }
+
+instance Pos [a] where { res _ = True }
+
+instance Pos Char where { res _ = True }
+
diff --git a/testsuite/tests/safeHaskell/ghci/all.T b/testsuite/tests/safeHaskell/ghci/all.T
new file mode 100644 (file)
index 0000000..4946a3b
--- /dev/null
@@ -0,0 +1,19 @@
+# Test GHCi works with Safe Haskell
+
+test('p1', normal, ghci_script, ['p1.script'])
+test('p2', normal, ghci_script, ['p2.script'])
+test('p3', normal, ghci_script, ['p3.script'])
+test('p4', normal, ghci_script, ['p4.script'])
+test('p5', normal, ghci_script, ['p5.script'])
+test('p6', normal, ghci_script, ['p6.script'])
+test('p7', normal, ghci_script, ['p7.script'])
+test('p8', normal, ghci_script, ['p8.script'])
+test('p9', normal, ghci_script, ['p9.script'])
+test('p10', normal, ghci_script, ['p10.script'])
+test('p11', normal, ghci_script, ['p11.script'])
+test('p12', normal, ghci_script, ['p12.script'])
+test('p13', normal, ghci_script, ['p13.script'])
+test('p14', normal, ghci_script, ['p14.script'])
+test('p15', normal, ghci_script, ['p15.script'])
+test('p16', normal, ghci_script, ['p16.script'])
+
diff --git a/testsuite/tests/safeHaskell/ghci/p1.script b/testsuite/tests/safeHaskell/ghci/p1.script
new file mode 100644 (file)
index 0000000..3c55ad7
--- /dev/null
@@ -0,0 +1,8 @@
+-- Test disabled language extensions
+:unset +s
+:set -XSafe
+
+:set -XTemplateHaskell
+
+:set -XGeneralizedNewtypeDeriving
+
diff --git a/testsuite/tests/safeHaskell/ghci/p1.stderr b/testsuite/tests/safeHaskell/ghci/p1.stderr
new file mode 100644 (file)
index 0000000..9446e1d
--- /dev/null
@@ -0,0 +1,6 @@
+
+<no location info>: Warning:
+    -XTemplateHaskell is not allowed in Safe Haskell; ignoring -XTemplateHaskell
+
+<no location info>: Warning:
+    -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
diff --git a/testsuite/tests/safeHaskell/ghci/p10.script b/testsuite/tests/safeHaskell/ghci/p10.script
new file mode 100644 (file)
index 0000000..e1cefae
--- /dev/null
@@ -0,0 +1,10 @@
+-- Test load works
+:unset +s
+:set -XSafe
+
+:load D
+
+a
+
+b
+
diff --git a/testsuite/tests/safeHaskell/ghci/p10.stdout b/testsuite/tests/safeHaskell/ghci/p10.stdout
new file mode 100644 (file)
index 0000000..2850e01
--- /dev/null
@@ -0,0 +1,3 @@
+Warning: can't use * imports with Safe Haskell; ignoring *
+1
+2
diff --git a/testsuite/tests/safeHaskell/ghci/p11.script b/testsuite/tests/safeHaskell/ghci/p11.script
new file mode 100644 (file)
index 0000000..19fb759
--- /dev/null
@@ -0,0 +1,6 @@
+-- Test load works
+:unset +s
+:set -XSafe
+
+:load E
+
diff --git a/testsuite/tests/safeHaskell/ghci/p11.stderr b/testsuite/tests/safeHaskell/ghci/p11.stderr
new file mode 100644 (file)
index 0000000..0d33615
--- /dev/null
@@ -0,0 +1,3 @@
+
+E.hs:3:1:
+    base:System.IO.Unsafe can't be safely imported! The module itself isn't safe.
diff --git a/testsuite/tests/safeHaskell/ghci/p12.script b/testsuite/tests/safeHaskell/ghci/p12.script
new file mode 100644 (file)
index 0000000..486302e
--- /dev/null
@@ -0,0 +1,10 @@
+-- Test you can't unset options
+:unset +s
+:set -XSafe
+:unset -XSafe
+
+:set -fpackage-trust
+:unset -fpackage-trust
+
+import Data.ByteString
+
diff --git a/testsuite/tests/safeHaskell/ghci/p12.stdout b/testsuite/tests/safeHaskell/ghci/p12.stdout
new file mode 100644 (file)
index 0000000..95fa91d
--- /dev/null
@@ -0,0 +1,4 @@
+don't know how to reverse -XSafe
+Some flags have not been recognized: -fno-package-trust
+*** Exception: bytestring-0.9.2.0:Data.ByteString 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/ghci/p13.script b/testsuite/tests/safeHaskell/ghci/p13.script
new file mode 100644 (file)
index 0000000..4e96c84
--- /dev/null
@@ -0,0 +1,14 @@
+-- Test restricted functionality: Overlapping
+:unset +s
+:set -XSafe
+:set -XOverlappingInstances
+:set -XFlexibleInstances
+
+:l P13_A
+
+instance Pos [Int] where { res _ = error "This curry is poisoned!" }
+
+res [1::Int, 2::Int]
+-- res 'c'
+-- res ['c']
+
diff --git a/testsuite/tests/safeHaskell/ghci/p13.stderr b/testsuite/tests/safeHaskell/ghci/p13.stderr
new file mode 100644 (file)
index 0000000..5e31e43
--- /dev/null
@@ -0,0 +1,13 @@
+
+<interactive>:12:1:
+    Unsafe overlapping instances for Pos [Int]
+      arising from a use of `res'
+    The matching instance is:
+      instance [overlap ok] [safe] Pos [Int]
+        -- Defined at <interactive>:10:10
+    It is compiled in a Safe module and as such can only
+    overlap instances from the same module, however it
+    overlaps the following instances from different modules:
+      instance [overlap ok] [safe] Pos [a] -- Defined at P13_A.hs:6:10
+    In the expression: res [1 :: Int, 2 :: Int]
+    In an equation for `it': it = res [1 :: Int, 2 :: Int]
diff --git a/testsuite/tests/safeHaskell/ghci/p13.stdout b/testsuite/tests/safeHaskell/ghci/p13.stdout
new file mode 100644 (file)
index 0000000..d203d98
--- /dev/null
@@ -0,0 +1 @@
+Warning: can't use * imports with Safe Haskell; ignoring *
diff --git a/testsuite/tests/safeHaskell/ghci/p14.script b/testsuite/tests/safeHaskell/ghci/p14.script
new file mode 100644 (file)
index 0000000..4802faf
--- /dev/null
@@ -0,0 +1,10 @@
+-- Test restricted functionality: RULES
+:unset +s
+:set -XSafe
+
+:set -fenable-rewrite-rules
+
+let f x = x - 1
+
+{-# RULES "id/Int" id = f #-}
+
diff --git a/testsuite/tests/safeHaskell/ghci/p14.stderr b/testsuite/tests/safeHaskell/ghci/p14.stderr
new file mode 100644 (file)
index 0000000..4a66d78
--- /dev/null
@@ -0,0 +1,2 @@
+
+<interactive>:10:1: parse error on input `{-# RULES'
diff --git a/testsuite/tests/safeHaskell/ghci/p15.script b/testsuite/tests/safeHaskell/ghci/p15.script
new file mode 100644 (file)
index 0000000..3faeec9
--- /dev/null
@@ -0,0 +1,23 @@
+-- Test restricted functionality: Data.Typeable
+:unset +s
+:set -XSafe
+:set -XDeriveDataTypeable
+:set -XStandaloneDeriving
+
+:m + Data.Typeable
+
+data H = H {h :: String} deriving (Typeable, Show)
+
+data G = G [Int] deriving (Show)
+
+instance Typeable G where { typeOf _ = typeOf (undefined :: H) }
+
+let x = H "Hello"
+let y = G [0]
+
+x
+y
+
+let (Just y_as_H) = (cast y) :: Maybe H
+y_as_H
+
diff --git a/testsuite/tests/safeHaskell/ghci/p15.stderr b/testsuite/tests/safeHaskell/ghci/p15.stderr
new file mode 100644 (file)
index 0000000..883f541
--- /dev/null
@@ -0,0 +1,12 @@
+
+<interactive>:14:10:
+    Can't create hand written instances of Typeable in Safe Haskell! Can only derive them
+
+<interactive>:22:22:
+    No instance for (Typeable G)
+      arising from a use of `cast'
+    Possible fix: add an instance declaration for (Typeable G)
+    In the expression: (cast y) :: Maybe H
+    In a pattern binding: (Just y_as_H) = (cast y) :: Maybe H
+
+<interactive>:23:1: Not in scope: `y_as_H'
diff --git a/testsuite/tests/safeHaskell/ghci/p15.stdout b/testsuite/tests/safeHaskell/ghci/p15.stdout
new file mode 100644 (file)
index 0000000..40b3f68
--- /dev/null
@@ -0,0 +1,2 @@
+H {h = "Hello"}
+G [0]
diff --git a/testsuite/tests/safeHaskell/ghci/p16.script b/testsuite/tests/safeHaskell/ghci/p16.script
new file mode 100644 (file)
index 0000000..2bcea65
--- /dev/null
@@ -0,0 +1,22 @@
+-- Test restricted functionality: GeneralizedNewtypeDeriving
+:unset +s
+:set -XSafe
+
+:set -XGeneralizedNewtypeDeriving
+
+class Op a where { op :: a -> String }
+
+data T = A | B | C deriving (Show)
+instance Op T where { op _ = "T" }
+
+newtype T1 = T1 T
+instance Op T1 where op _ = "t1"
+
+newtype T2 = T2 T deriving (Op)
+
+let x = T1 A
+let y = T2 A
+
+op x
+op y
+
diff --git a/testsuite/tests/safeHaskell/ghci/p16.stderr b/testsuite/tests/safeHaskell/ghci/p16.stderr
new file mode 100644 (file)
index 0000000..33602c7
--- /dev/null
@@ -0,0 +1,15 @@
+
+<no location info>: Warning:
+    -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
+
+<interactive>:16:29:
+    Can't make a derived instance of `Op T2':
+      `Op' is not a derivable class
+      Try -XGeneralizedNewtypeDeriving for GHC's newtype-deriving extension
+    In the newtype declaration for `T2'
+
+<interactive>:19:9:
+    Not in scope: data constructor `T2'
+    Perhaps you meant `T1' (line 13)
+
+<interactive>:22:4: Not in scope: `y'
diff --git a/testsuite/tests/safeHaskell/ghci/p16.stdout b/testsuite/tests/safeHaskell/ghci/p16.stdout
new file mode 100644 (file)
index 0000000..233a1e1
--- /dev/null
@@ -0,0 +1 @@
+"t1"
diff --git a/testsuite/tests/safeHaskell/ghci/p2.script b/testsuite/tests/safeHaskell/ghci/p2.script
new file mode 100644 (file)
index 0000000..c219116
--- /dev/null
@@ -0,0 +1,10 @@
+-- Test bad options
+
+:unset +s
+:set -XSafe
+
+-- we actually allow this for now but may want to revist this decision
+:set -trust base
+:set -distrust base
+:set -distrust-all
+
diff --git a/testsuite/tests/safeHaskell/ghci/p2.stderr b/testsuite/tests/safeHaskell/ghci/p2.stderr
new file mode 100644 (file)
index 0000000..342bb05
--- /dev/null
@@ -0,0 +1,2 @@
+package flags have changed, resetting and loading new packages...
+package flags have changed, resetting and loading new packages...
diff --git a/testsuite/tests/safeHaskell/ghci/p2.stdout b/testsuite/tests/safeHaskell/ghci/p2.stdout
new file mode 100644 (file)
index 0000000..c6efa9e
--- /dev/null
@@ -0,0 +1,2 @@
+cannot satisfy -package -all
+    (use -v for more information)
diff --git a/testsuite/tests/safeHaskell/ghci/p3.script b/testsuite/tests/safeHaskell/ghci/p3.script
new file mode 100644 (file)
index 0000000..c2d9061
--- /dev/null
@@ -0,0 +1,12 @@
+-- Test bad imports
+:unset +s
+:set -XSafe
+
+import System.IO.Unsafe
+
+-- test trustworthy and package flag
+import Data.ByteString
+
+:set -fpackage-trust
+import Data.ByteString
+
diff --git a/testsuite/tests/safeHaskell/ghci/p3.stderr b/testsuite/tests/safeHaskell/ghci/p3.stderr
new file mode 100644 (file)
index 0000000..55dd279
--- /dev/null
@@ -0,0 +1,3 @@
+
+<no location info>:
+    base:System.IO.Unsafe can't be safely imported! The module itself isn't safe.
diff --git a/testsuite/tests/safeHaskell/ghci/p3.stdout b/testsuite/tests/safeHaskell/ghci/p3.stdout
new file mode 100644 (file)
index 0000000..a415a7e
--- /dev/null
@@ -0,0 +1,3 @@
+can't import System.IO.Unsafe as it isn't trusted.
+*** Exception: bytestring-0.9.2.0:Data.ByteString 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/ghci/p4.script b/testsuite/tests/safeHaskell/ghci/p4.script
new file mode 100644 (file)
index 0000000..8d78f40
--- /dev/null
@@ -0,0 +1,8 @@
+-- Test bad direct calls
+:unset +s
+:set -XSafe
+
+let x = System.IO.Unsafe.unsafePerformIO
+let y = x (putStrLn "Hello" >> return 1)
+y
+
diff --git a/testsuite/tests/safeHaskell/ghci/p4.stderr b/testsuite/tests/safeHaskell/ghci/p4.stderr
new file mode 100644 (file)
index 0000000..8ff4107
--- /dev/null
@@ -0,0 +1,6 @@
+
+<interactive>:6:9: Not in scope: `System.IO.Unsafe.unsafePerformIO'
+
+<interactive>:7:9: Not in scope: `x'
+
+<interactive>:8:1: Not in scope: `y'
diff --git a/testsuite/tests/safeHaskell/ghci/p5.script b/testsuite/tests/safeHaskell/ghci/p5.script
new file mode 100644 (file)
index 0000000..cdf6088
--- /dev/null
@@ -0,0 +1,13 @@
+-- Test unsetting safe
+:unset +s
+:set -XSafe
+
+:set -XSafe
+:unset -XSafe
+
+:set -XTrustworthy
+:unset -XTrustworthy
+
+:set -XUnsafe
+:unset -XUnsafe
+
diff --git a/testsuite/tests/safeHaskell/ghci/p5.stdout b/testsuite/tests/safeHaskell/ghci/p5.stdout
new file mode 100644 (file)
index 0000000..3f649f7
--- /dev/null
@@ -0,0 +1,7 @@
+don't know how to reverse -XSafe
+ghc-stage2: <no location info>: Incompatible Safe Haskell flags! (Safe, Trustworthy)
+Usage: For basic information, try the `--help' option.
+don't know how to reverse -XTrustworthy
+ghc-stage2: <no location info>: Incompatible Safe Haskell flags! (Safe, Unsafe)
+Usage: For basic information, try the `--help' option.
+don't know how to reverse -XUnsafe
diff --git a/testsuite/tests/safeHaskell/ghci/p6.script b/testsuite/tests/safeHaskell/ghci/p6.script
new file mode 100644 (file)
index 0000000..8590fd6
--- /dev/null
@@ -0,0 +1,13 @@
+-- Test restricted functionality: FFI
+:unset +s
+:set -XSafe
+
+:set  -XForeignFunctionInterface
+
+foreign import ccall "sin" c_sin' :: Double -> IO Double
+x <- c_sin' 1
+x
+
+foreign import ccall "sin" c_sin  :: Double -> Double
+c_sin 1
+
diff --git a/testsuite/tests/safeHaskell/ghci/p6.stderr b/testsuite/tests/safeHaskell/ghci/p6.stderr
new file mode 100644 (file)
index 0000000..b32c521
--- /dev/null
@@ -0,0 +1,10 @@
+
+<interactive>:12:1:
+    Unacceptable result type in foreign declaration: Double
+    Safe Haskell is on, all FFI imports must be in the IO monad
+    When checking declaration:
+      foreign import ccall safe "static sin" c_sin :: Double -> Double
+
+<interactive>:13:1:
+    Not in scope: `c_sin'
+    Perhaps you meant c_sin' (line 8)
diff --git a/testsuite/tests/safeHaskell/ghci/p6.stdout b/testsuite/tests/safeHaskell/ghci/p6.stdout
new file mode 100644 (file)
index 0000000..e83a344
--- /dev/null
@@ -0,0 +1 @@
+0.8414709848078965
diff --git a/testsuite/tests/safeHaskell/ghci/p7.script b/testsuite/tests/safeHaskell/ghci/p7.script
new file mode 100644 (file)
index 0000000..ea4190b
--- /dev/null
@@ -0,0 +1,6 @@
+-- Test load works
+:unset +s
+:set -XSafe
+
+:load A
+
diff --git a/testsuite/tests/safeHaskell/ghci/p7.stdout b/testsuite/tests/safeHaskell/ghci/p7.stdout
new file mode 100644 (file)
index 0000000..674794f
--- /dev/null
@@ -0,0 +1,2 @@
+ghc-stage2: A.hs:1:14-24: Incompatible Safe Haskell flags! (Safe, Trustworthy)
+Usage: For basic information, try the `--help' option.
diff --git a/testsuite/tests/safeHaskell/ghci/p8.script b/testsuite/tests/safeHaskell/ghci/p8.script
new file mode 100644 (file)
index 0000000..7d5101f
--- /dev/null
@@ -0,0 +1,6 @@
+-- Test load works
+:unset +s
+:set -XSafe
+
+:load B
+
diff --git a/testsuite/tests/safeHaskell/ghci/p8.stdout b/testsuite/tests/safeHaskell/ghci/p8.stdout
new file mode 100644 (file)
index 0000000..8280f4a
--- /dev/null
@@ -0,0 +1,2 @@
+ghc-stage2: B.hs:1:14-19: Incompatible Safe Haskell flags! (Safe, Unsafe)
+Usage: For basic information, try the `--help' option.
diff --git a/testsuite/tests/safeHaskell/ghci/p9.script b/testsuite/tests/safeHaskell/ghci/p9.script
new file mode 100644 (file)
index 0000000..298944d
--- /dev/null
@@ -0,0 +1,10 @@
+-- Test load works
+:unset +s
+:set -XSafe
+
+:load C
+
+a
+
+b
+
diff --git a/testsuite/tests/safeHaskell/ghci/p9.stderr b/testsuite/tests/safeHaskell/ghci/p9.stderr
new file mode 100644 (file)
index 0000000..7689489
--- /dev/null
@@ -0,0 +1,2 @@
+
+<interactive>:10:1: Not in scope: `b'
diff --git a/testsuite/tests/safeHaskell/ghci/p9.stdout b/testsuite/tests/safeHaskell/ghci/p9.stdout
new file mode 100644 (file)
index 0000000..69acee7
--- /dev/null
@@ -0,0 +1,2 @@
+Warning: can't use * imports with Safe Haskell; ignoring *
+1