summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-11-11 11:05:16 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-11 11:05:16 +0100
commitfbc2537c0b2cbe947684bb39669643f1ef9d96c0 (patch)
tree2d8a8f0e78e4109437c615986e2e88b1ff78e61b /testsuite/tests
parent5eb56eddaaa7bef3da864f6cd297bad39d6bf76c (diff)
downloadhaskell-fbc2537c0b2cbe947684bb39669643f1ef9d96c0.tar.gz
OPTIONS_GHC compiler flags may contain spaces (#4931)
When a .hsc contains `#define FOO "bar baz"`, hsc2hs emits: {-# OPTIONS_GHC -optc-DFOO="bar baz" #-} Make sure GHC can compile this, by tweaking `HeaderInfo.getOptions` a bit. Test Plan: driver/T4931 Reviewers: austin, bgamari Reviewed By: bgamari Differential Revision: https://phabricator.haskell.org/D1452 GHC Trac Issues: #4931
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/driver/T4931.hs8
-rw-r--r--testsuite/tests/driver/T4931.stdout1
-rw-r--r--testsuite/tests/driver/all.T1
3 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/driver/T4931.hs b/testsuite/tests/driver/T4931.hs
new file mode 100644
index 0000000000..08b583a68d
--- /dev/null
+++ b/testsuite/tests/driver/T4931.hs
@@ -0,0 +1,8 @@
+{-# LANGUAGE CPP #-}
+{-# OPTIONS_GHC -DFOO="bar baz" #-}
+main = print FOO
+
+-- Test that GHC can compile option pragmas containing spaces.
+-- When a .hsc contains `#define FOO "bar baz"`, hsc2hs emits:
+--
+-- {-# OPTIONS_GHC -optc-DFOO="bar baz" #-}
diff --git a/testsuite/tests/driver/T4931.stdout b/testsuite/tests/driver/T4931.stdout
new file mode 100644
index 0000000000..447cd7a651
--- /dev/null
+++ b/testsuite/tests/driver/T4931.stdout
@@ -0,0 +1 @@
+"bar baz"
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 7c74cb690a..5c0de6eaec 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -459,3 +459,4 @@ test('T9360b', normal, run_command, ['{compiler} -e "" --interactive'])
test('T10970', normal, compile_and_run, ['-hide-all-packages -package base -package containers'])
test('T10970a', normal, compile_and_run, [''])
+test('T4931', normal, compile_and_run, [''])