diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-03-21 16:47:51 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-03-30 22:23:59 -0400 |
commit | a801e620ea203028d5d9eebb4fb2a66fac16950c (patch) | |
tree | 6882cfacfda5f0c35efc434dc778cd6e7c9900b3 | |
parent | deaaf055a37a2f25d2a423701194458addf033f8 (diff) | |
download | haskell-a801e620ea203028d5d9eebb4fb2a66fac16950c.tar.gz |
testsuite: Split T13366 into two tests
Split up the C and C++ uses since the latter is significantly more
platform-dependent.
-rw-r--r-- | testsuite/tests/th/T13366C.hs | 23 | ||||
-rw-r--r-- | testsuite/tests/th/T13366C.stdout | 2 | ||||
-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.T | 6 |
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, |