summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/th/T13366C.hs23
-rw-r--r--testsuite/tests/th/T13366C.stdout2
-rw-r--r--testsuite/tests/th/T13366Cxx.hs (renamed from testsuite/tests/th/T13366.hs)14
-rw-r--r--testsuite/tests/th/T13366Cxx.stdout (renamed from testsuite/tests/th/T13366.stdout)2
-rw-r--r--testsuite/tests/th/all.T6
5 files changed, 30 insertions, 17 deletions
diff --git a/testsuite/tests/th/T13366C.hs b/testsuite/tests/th/T13366C.hs
new file mode 100644
index 0000000000..246687dcf0
--- /dev/null
+++ b/testsuite/tests/th/T13366C.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE TemplateHaskell #-}
+{-# OPTIONS_GHC -optc-DA_MACRO=1 -optcxx-DA_MACRO=1 #-}
+
+import Language.Haskell.TH.Syntax
+import System.IO (hFlush, stdout)
+
+foreign import ccall fc :: Int -> IO Int
+
+do addForeignSource LangC $ unlines
+ [ "#include <stdio.h>"
+ , "int fc(int x) {"
+ , " printf(\"calling f(%d)\\n\",x);"
+ , " fflush(stdout);"
+ , " return A_MACRO + x;"
+ , "}"
+ ]
+ return []
+
+main :: IO ()
+main = do
+ fc 2 >>= print
+ hFlush stdout
diff --git a/testsuite/tests/th/T13366C.stdout b/testsuite/tests/th/T13366C.stdout
new file mode 100644
index 0000000000..2ab79e85b8
--- /dev/null
+++ b/testsuite/tests/th/T13366C.stdout
@@ -0,0 +1,2 @@
+calling f(2)
+3
diff --git a/testsuite/tests/th/T13366.hs b/testsuite/tests/th/T13366Cxx.hs
index 7d998f2ae8..37ab25a4d1 100644
--- a/testsuite/tests/th/T13366.hs
+++ b/testsuite/tests/th/T13366Cxx.hs
@@ -5,18 +5,6 @@
import Language.Haskell.TH.Syntax
import System.IO (hFlush, stdout)
-foreign import ccall fc :: Int -> IO Int
-
-do addForeignSource LangC $ unlines
- [ "#include <stdio.h>"
- , "int fc(int x) {"
- , " printf(\"calling f(%d)\\n\",x);"
- , " fflush(stdout);"
- , " return A_MACRO + x;"
- , "}"
- ]
- return []
-
foreign import ccall fcxx :: Int -> IO Int
do addForeignSource LangCxx $ unlines
@@ -33,7 +21,5 @@ do addForeignSource LangCxx $ unlines
main :: IO ()
main = do
- fc 2 >>= print
- hFlush stdout
fcxx 5 >>= print
hFlush stdout
diff --git a/testsuite/tests/th/T13366.stdout b/testsuite/tests/th/T13366Cxx.stdout
index 16cfeeb9fa..bdf7a41a33 100644
--- a/testsuite/tests/th/T13366.stdout
+++ b/testsuite/tests/th/T13366Cxx.stdout
@@ -1,4 +1,2 @@
-calling f(2)
-3
calling fcxx(5)
6
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 7fd9ce6bed..315baff2fa 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -395,7 +395,11 @@ test('T13018', normal, compile, ['-v0'])
test('T13123', normal, compile, ['-v0'])
test('T13098', normal, compile, ['-v0'])
test('T11046', normal, multimod_compile, ['T11046','-v0'])
-test('T13366',
+test('T13366C',
+ [expect_broken_for(13366, ['ghci'])],
+ compile_and_run,
+ ['-v0'])
+test('T13366Cxx',
[expect_broken_for(13366, ['ghci']),
when(opsys('darwin'), expect_broken(16083))],
compile_and_run,