[commit: ghc] master: Add test for #6132: hash bang + CPP (0b00add)

git at git.haskell.org git at git.haskell.org
Sat Feb 20 22:20:32 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/0b00add03043804211f567a3d0810114c0274252/ghc

>---------------------------------------------------------------

commit 0b00add03043804211f567a3d0810114c0274252
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Sat Feb 20 23:07:50 2016 +0100

    Add test for #6132: hash bang + CPP


>---------------------------------------------------------------

0b00add03043804211f567a3d0810114c0274252
 testsuite/tests/runghc/T6132.hs | 15 +++++++++++++++
 testsuite/tests/runghc/all.T    |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/testsuite/tests/runghc/T6132.hs b/testsuite/tests/runghc/T6132.hs
new file mode 100644
index 0000000..dbb996b
--- /dev/null
+++ b/testsuite/tests/runghc/T6132.hs
@@ -0,0 +1,15 @@
+#!/usr/bin/env whatever
+
+{-# LANGUAGE CPP #-}
+
+module Main where
+
+-- Compiling a program with CPP that also has a hash bang should work (#6132).
+-- Before ghc-7.8, it failed with:
+--
+-- error: invalid preprocessing directive #!
+-- #!/usr/bin/env runghc
+
+#if 1
+main = return ()
+#endif
diff --git a/testsuite/tests/runghc/all.T b/testsuite/tests/runghc/all.T
index 0403fbc..7c4fad2 100644
--- a/testsuite/tests/runghc/all.T
+++ b/testsuite/tests/runghc/all.T
@@ -6,3 +6,5 @@ test('T8601', req_interp, run_command,
 
 test('T11247', [req_interp, expect_broken(11247)], run_command,
      ['$MAKE --no-print-directory -s T11247'])
+
+test('T6132', [], compile, [''])



More information about the ghc-commits mailing list