Commit ed0bb9be authored by dterei's avatar dterei
Browse files

Modify and add a bunch of new tests for Safe Haskell changes

parent a4a8a28f
{-# LANGUAGE SafeImports #-}
{-# GHC_OPTIONS -fpackage-trust #-}
{-# LANGUAGE Unsafe #-}
module Check01 ( main' ) where
import safe Check01_B
......
{-# LANGUAGE SafeImports #-}
{-# LANGUAGE Unsafe #-}
module Check02 ( main' ) where
import safe Check02_B
......
{-# LANGUAGE SafeImports #-}
{-# LANGUAGE Unsafe #-}
module Main ( main ) where
import Check04_1
......
{-# LANGUAGE SafeImports #-}
{-# LANGUAGE Unsafe #-}
module Check04_1 ( main' ) where
import safe Check04_B
......
......@@ -16,20 +16,20 @@ test('CheckB',
test('Check01', normal, multi_compile_fail, ['Check01 -distrust base', [
('Check01_A.hs', ''),
('Check01_B.hs', '-trust base')
], ''])
], '-fpackage-trust'])
# suceed this time since we trust base when we compile AND use CheckB
test('Check02', normal, multi_compile, ['Check02', [
('Check02_A.hs', ''),
('Check02_B.hs', '')
], '-trust base'])
], '-trust base -fpackage-trust'])
# suceed as while like Check01_fail we don't import CheckB as a safe
# import this time, so don't require base trusted when used.
test('Check03', normal, multi_compile, ['Check03', [
('Check03_A.hs', ''),
('Check03_B.hs', '-trust base')
], ''])
], '-fpackage-trust'])
# Check a slightly larger transitive program. Check01 isn't imported
# safely by Check03 so we don't require base trused at end.
......@@ -37,5 +37,5 @@ test('Check04', normal, multi_compile, ['Check04', [
('Check04_A.hs', ''),
('Check04_B.hs', '-trust base'),
('Check04_1.hs', '-trust base')
], ''])
], '-fpackage-trust'])
SafeFlags04.hs:1:14: Unsupported extension: SafeImport
{-# LANGUAGE Safe, SafeImports #-}
{-# LANGUAGE Safe, Unsafe #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags05 where
......
{-# LANGUAGE Trustworthy, SafeImports #-}
{-# LANGUAGE Trustworthy, Unsafe #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags06 where
......
{-# LANGUAGE SafeLanguage, SafeImports #-}
{-# LANGUAGE SafeLanguage, Unsafe #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags07 where
......
{-# LANGUAGE Unsafe #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags12 where
f :: Int
f = 1
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE Unsafe #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags13 where
f :: Int
f = 1
{-# LANGUAGE Safe #-}
{-# LANGUAGE Unsafe #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags14 where
f :: Int
f = 1
{-# LANGUAGE Unsafe #-}
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags15 where
f :: Int
f = 1
{-# LANGUAGE Trustworthy #-}
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags15 where
f :: Int
f = 1
{-# LANGUAGE Safe #-}
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags15 where
f :: Int
f = 1
{-# OPTIONS_GHC -fpackage-trust #-}
-- | Basic test to see if Safe flags compiles
module SafeFlags15 where
f :: Int
f = 1
{-# OPTIONS_GHC -fno-package-trust #-}
-- | 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
f :: Int
f = 1
......@@ -9,25 +9,36 @@ def f( opts ):
setTestOpts(f)
test('SafeFlags01', normal, compile, ['-trust base'])
test('SafeFlags01', normal, compile, [''])
test('SafeFlags02', normal, compile, [''])
test('SafeFlags03', normal, compile, [''])
# no longer support a SafeImport flag, so expect fail for them.
test('SafeFlags03', normal, compile_fail, [''])
# no longer support a SafeLanguage flag, so expect fail for them.
test('SafeFlags04', normal, compile_fail, ['-trust base'])
test('SafeFlags04', normal, compile_fail, [''])
test('SafeFlags05', normal, compile, ['-trust base'])
test('SafeFlags06', normal, compile, [''])
test('SafeFlags05', normal, compile_fail, [''])
test('SafeFlags06', normal, compile_fail, [''])
# no longer support a SafeLanguage flag, so expect fail for them.
test('SafeFlags07', normal, compile_fail, ['-trust base'])
test('SafeFlags07', normal, compile_fail, [''])
# no longer support a SafeLanguage flag, so expect fail for them.
test('SafeFlags08', normal, compile_fail, ['-trust base'])
test('SafeFlags08', normal, compile_fail, [''])
test('SafeFlags09', normal, compile_fail, [''])
test('SafeFlags10', normal, compile_fail, [''])
test('SafeFlags11', normal, compile, ['-trust base'])
test('SafeFlags11', normal, compile, [''])
test('SafeFlags12', normal, compile, [''])
test('SafeFlags13', normal, compile_fail, [''])
test('SafeFlags14', normal, compile_fail, [''])
test('SafeFlags15', normal, compile, [''])
test('SafeFlags16', normal, compile, [''])
test('SafeFlags17', normal, compile, [''])
test('SafeFlags18', normal, compile, [''])
test('SafeFlags19', normal, compile_fail, [''])
test('Flags01', normal, compile, [''])
test('Flags02', normal, compile, [''])
......
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
-- | Should fail compilation because safe imports aren't enabled
module Mixed01 where
import safe Data.Word
f :: Int
f = 1
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