Commit ac8c6325 authored by dterei's avatar dterei
Browse files

Add more Safe Haskell tests for new design

parent ed0bb9be
......@@ -945,9 +945,9 @@ def checkStats(stats_file, num_fields):
def extras_build( way, extra_mods, extra_hc_opts ):
for modopts in extra_mods:
mod, opts = modopts
result = simple_build( mod, way, opts + extra_hc_opts, 0, '', 0, 0, 0)
if not (mod.endswith(".hs") or mod.endswith(".lhs")):
extra_hc_opts += " " + replace_suffix(mod, 'o')
result = simple_build( mod, way, opts + ' ' + extra_hc_opts, 0, '', 0, 0, 0)
if not (mod.endswith('.hs') or mod.endswith('.lhs')):
extra_hc_opts += ' ' + replace_suffix(mod, 'o')
if badResult(result):
return result
......
{-# LANGUAGE SafeImports #-}
{-# LANGUAGE SafeImport #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags03 where
......
SafeFlags04.hs:1:14: Unsupported extension: SafeImport
SafeFlags03.hs:1:14: Unsupported extension: SafeImport
ghc-stage2: SafeFlags05.hs:1:20-25: Incompatible Safe Haskell flags! (Safe, Unsafe)
Usage: For basic information, try the `--help' option.
ghc-stage2: SafeFlags06.hs:1:27-32: Incompatible Safe Haskell flags! (Trustworthy, Unsafe)
Usage: For basic information, try the `--help' option.
ghc-stage2: SafeFlags13.hs:2:14-19: Incompatible Safe Haskell flags! (Trustworthy, Unsafe)
Usage: For basic information, try the `--help' option.
ghc-stage2: SafeFlags14.hs:2:14-19: Incompatible Safe Haskell flags! (Safe, Unsafe)
Usage: For basic information, try the `--help' option.
{-# LANGUAGE Trustworthy #-}
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags15 where
module SafeFlags16 where
f :: Int
f = 1
......
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags15 where
module SafeFlags17 where
f :: Int
f = 1
......
SafeFlags17.hs:4:8:
base:Prelude can't be safely imported! The package (base) the module resides in isn't trusted.
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags15 where
module SafeFlags18 where
f :: Int
f = 1
......
......@@ -2,7 +2,7 @@
-- | Basic test to see if Safe flags compiles
-- test should fail as there shouldn't be a no-package-trust flag, only a
-- package-trust flag!
module SafeFlags15 where
module SafeFlags19 where
f :: Int
f = 1
......
SafeFlags19.hs:1:16:
unknown flag in {-# OPTIONS_GHC #-} pragma: -fno-package-trust
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags20 where
f :: Int
f = 1
......@@ -36,9 +36,10 @@ test('SafeFlags14', normal, compile_fail, [''])
test('SafeFlags15', normal, compile, [''])
test('SafeFlags16', normal, compile, [''])
test('SafeFlags17', normal, compile, [''])
test('SafeFlags17', normal, compile_fail, ['-distrust base'])
test('SafeFlags18', normal, compile, [''])
test('SafeFlags19', normal, compile_fail, [''])
test('SafeFlags20', normal, compile, ['-trust base'])
test('Flags01', normal, compile, [''])
test('Flags02', normal, compile, [''])
......
-- | Should fail compilation because safe imports aren't enabled
-- not because of trying to import an unsafe module
module Mixed01 where
import safe Data.Word
import safe System.IO.Unsafe
f :: Int
f = 1
......
Mixed02.hs:5:1:
Module DW is imported both as a safe and unsafe import!
{-# LANGUAGE Safe #-}
module SafeInfered01 where
import safe SafeInfered01_A.hs
import safe SafeInfered01_A
g :: Int
g = f
......
{-# LANGUAGE DeriveDataTypeable #-}
-- | Only uses deriving of Typeable so should be considered safe
module SafeInfered02_A where
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment