summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-11-04 18:18:30 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-11-05 10:12:16 -0400
commitbe3750a5a3cbc59a7b84f1f7603f308aee1cc80b (patch)
tree0c30a5633f67be2e13123c73e56e777a7077725a /testsuite
parent59dfb00584e6d24d82d3f5338c6299bae48e0468 (diff)
downloadhaskell-be3750a5a3cbc59a7b84f1f7603f308aee1cc80b.tar.gz
Allow CApi FFI calls in GHCi
At some point in the past this started working. I noticed this when working on multiple home units and couldn't load GHC's dependencies into the interpreter. Fixes #7388
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghci/scripts/T7388.hs6
-rw-r--r--testsuite/tests/ghci/scripts/T7388.script2
-rw-r--r--testsuite/tests/ghci/scripts/T7388.stdout1
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
4 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T7388.hs b/testsuite/tests/ghci/scripts/T7388.hs
new file mode 100644
index 0000000000..91ca1c7268
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T7388.hs
@@ -0,0 +1,6 @@
+{-# LANGUAGE CApiFFI #-}
+module T7388 where
+
+import Foreign.C
+
+foreign import capi "stdio.h printf" printfb :: CString -> CInt -> IO ()
diff --git a/testsuite/tests/ghci/scripts/T7388.script b/testsuite/tests/ghci/scripts/T7388.script
new file mode 100644
index 0000000000..7f02d86453
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T7388.script
@@ -0,0 +1,2 @@
+:l T7388
+withCString "I am a working CApi FFI call\n" $ \str -> printfb str 0
diff --git a/testsuite/tests/ghci/scripts/T7388.stdout b/testsuite/tests/ghci/scripts/T7388.stdout
new file mode 100644
index 0000000000..b9ac187b44
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T7388.stdout
@@ -0,0 +1 @@
+I am a working CApi FFI call
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 80f3eb8f02..4db3ba2f7b 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -346,3 +346,4 @@ test('T20019', normal, ghci_script, ['T20019.script'])
test('T20101', normal, ghci_script, ['T20101.script'])
test('T20206', normal, ghci_script, ['T20206.script'])
test('T20217', normal, ghci_script, ['T20217.script'])
+test('T7388', normal, ghci_script, ['T7388.script'])