diff options
Diffstat (limited to 'testsuite/tests/safeHaskell/flags')
21 files changed, 153 insertions, 0 deletions
diff --git a/testsuite/tests/safeHaskell/flags/Flags01.hs b/testsuite/tests/safeHaskell/flags/Flags01.hs new file mode 100644 index 0000000000..0e1d120a81 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/Flags01.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE CPP #-} + +-- | CPP should still be allowed +module Main where + +#include "Flags01_A.cpp" + +#define mainn main=putStrLn str + +mainn + diff --git a/testsuite/tests/safeHaskell/flags/Flags01_A.cpp b/testsuite/tests/safeHaskell/flags/Flags01_A.cpp new file mode 100644 index 0000000000..9170664236 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/Flags01_A.cpp @@ -0,0 +1,3 @@ +str :: String +str = "Hello World" + diff --git a/testsuite/tests/safeHaskell/flags/Flags02.hs b/testsuite/tests/safeHaskell/flags/Flags02.hs new file mode 100644 index 0000000000..525064dedf --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/Flags02.hs @@ -0,0 +1,8 @@ +{-# OPTIONS_GHC -pgmlc pgmlc, -pgmdll pgmdll, -I., -L., -Uggg, -Dggg, -with-rtsopts full #-} + +-- | These are all flags that should be allowed +module Flags02 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/Makefile b/testsuite/tests/safeHaskell/flags/Makefile new file mode 100644 index 0000000000..9101fbd40a --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/Makefile @@ -0,0 +1,3 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags01.hs b/testsuite/tests/safeHaskell/flags/SafeFlags01.hs new file mode 100644 index 0000000000..f5790eba64 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags01.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags01 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags02.hs b/testsuite/tests/safeHaskell/flags/SafeFlags02.hs new file mode 100644 index 0000000000..50a1101bd4 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags02.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags02 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags03.hs b/testsuite/tests/safeHaskell/flags/SafeFlags03.hs new file mode 100644 index 0000000000..ea83a06210 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags03.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE SafeImports #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags03 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags04.hs b/testsuite/tests/safeHaskell/flags/SafeFlags04.hs new file mode 100644 index 0000000000..b966eba1a0 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags04.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE SafeLanguage #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags04 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags04.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags04.stderr new file mode 100644 index 0000000000..2a550f25a1 --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags04.stderr @@ -0,0 +1,2 @@ + +SafeFlags04.hs:1:14: Unsupported extension: SafeLanguage diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags05.hs b/testsuite/tests/safeHaskell/flags/SafeFlags05.hs new file mode 100644 index 0000000000..0f316d475b --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags05.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe, SafeImports #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags05 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags06.hs b/testsuite/tests/safeHaskell/flags/SafeFlags06.hs new file mode 100644 index 0000000000..81fd3257ae --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags06.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Trustworthy, SafeImports #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags06 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags07.hs b/testsuite/tests/safeHaskell/flags/SafeFlags07.hs new file mode 100644 index 0000000000..0339fe362f --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags07.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE SafeLanguage, SafeImports #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags07 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags07.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags07.stderr new file mode 100644 index 0000000000..3c3317f20c --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags07.stderr @@ -0,0 +1,2 @@ + +SafeFlags07.hs:1:14: Unsupported extension: SafeLanguage diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags08.hs b/testsuite/tests/safeHaskell/flags/SafeFlags08.hs new file mode 100644 index 0000000000..445e591b1e --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags08.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE SafeLanguage, Trustworthy #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags08 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags08.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags08.stderr new file mode 100644 index 0000000000..e72e6e459f --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags08.stderr @@ -0,0 +1,2 @@ + +SafeFlags08.hs:1:14: Unsupported extension: SafeLanguage diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags09.hs b/testsuite/tests/safeHaskell/flags/SafeFlags09.hs new file mode 100644 index 0000000000..d03b0dacbf --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags09.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE SafeLanguage, Safe #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags09 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags09.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags09.stderr new file mode 100644 index 0000000000..2bc5aed21c --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags09.stderr @@ -0,0 +1,2 @@ + +SafeFlags09.hs:1:14: Unsupported extension: SafeLanguage diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags10.hs b/testsuite/tests/safeHaskell/flags/SafeFlags10.hs new file mode 100644 index 0000000000..43ba5c81cd --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags10.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE Safe, Trustworthy #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags10 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags10.stderr b/testsuite/tests/safeHaskell/flags/SafeFlags10.stderr new file mode 100644 index 0000000000..86346b77fe --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags10.stderr @@ -0,0 +1,2 @@ +ghc-stage2: SafeFlags10.hs:1:20-30: Incompatible Safe Haskell flags! (Safe, Trustworthy) +Usage: For basic information, try the `--help' option. diff --git a/testsuite/tests/safeHaskell/flags/SafeFlags11.hs b/testsuite/tests/safeHaskell/flags/SafeFlags11.hs new file mode 100644 index 0000000000..e90b105dde --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/SafeFlags11.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE Safe #-} +{-# LANGUAGE Safe #-} + +-- | Basic test to see if Safe flags compiles +module SafeFlags11 where + +f :: Int +f = 1 + diff --git a/testsuite/tests/safeHaskell/flags/all.T b/testsuite/tests/safeHaskell/flags/all.T new file mode 100644 index 0000000000..7848b8328d --- /dev/null +++ b/testsuite/tests/safeHaskell/flags/all.T @@ -0,0 +1,29 @@ +# Just do the normal way, SafeHaskell is all in the frontend +def f( opts ): + opts.only_ways = ['normal'] + +setTestOpts(f) + +test('SafeFlags01', normal, compile, ['-trust base']) +test('SafeFlags02', normal, compile, ['']) +test('SafeFlags03', normal, compile, ['']) + +# no longer support a SafeLanguage flag, so expect fail for them. +test('SafeFlags04', normal, compile_fail, ['-trust base']) + +test('SafeFlags05', normal, compile, ['-trust base']) +test('SafeFlags06', normal, compile, ['']) + +# no longer support a SafeLanguage flag, so expect fail for them. +test('SafeFlags07', normal, compile_fail, ['-trust base']) + +# no longer support a SafeLanguage flag, so expect fail for them. +test('SafeFlags08', normal, compile_fail, ['-trust base']) +test('SafeFlags09', normal, compile_fail, ['']) + +test('SafeFlags10', normal, compile_fail, ['']) +test('SafeFlags11', normal, compile, ['-trust base']) + +test('Flags01', normal, compile, ['']) +test('Flags02', normal, compile, ['']) + |