summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/ffi/should_run/all.T5
-rw-r--r--testsuite/tests/ffi/should_run/capi_value.hs14
-rw-r--r--testsuite/tests/ffi/should_run/capi_value.stdout2
-rw-r--r--testsuite/tests/ffi/should_run/capi_value_c.c4
-rw-r--r--testsuite/tests/ffi/should_run/capi_value_c.h3
5 files changed, 28 insertions, 0 deletions
diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T
index a8c3553735..30eba8ee0e 100644
--- a/testsuite/tests/ffi/should_run/all.T
+++ b/testsuite/tests/ffi/should_run/all.T
@@ -206,3 +206,8 @@ test('ffi_parsing_001',
compile_and_run,
['ffi_parsing_001_c.c'])
+test('capi_value',
+ extra_clean(['capi_value_c.o']),
+ compile_and_run,
+ ['capi_value_c.c'])
+
diff --git a/testsuite/tests/ffi/should_run/capi_value.hs b/testsuite/tests/ffi/should_run/capi_value.hs
new file mode 100644
index 0000000000..131e97ae26
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/capi_value.hs
@@ -0,0 +1,14 @@
+
+{-# LANGUAGE CApiFFI #-}
+
+module Main (main) where
+
+import Foreign.C
+
+main :: IO ()
+main = do print i
+ print j
+
+foreign import capi "capi_value_c.h value i" i :: CInt
+foreign import capi "capi_value_c.h value j" j :: CInt
+
diff --git a/testsuite/tests/ffi/should_run/capi_value.stdout b/testsuite/tests/ffi/should_run/capi_value.stdout
new file mode 100644
index 0000000000..e120905029
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/capi_value.stdout
@@ -0,0 +1,2 @@
+23
+24
diff --git a/testsuite/tests/ffi/should_run/capi_value_c.c b/testsuite/tests/ffi/should_run/capi_value_c.c
new file mode 100644
index 0000000000..45db07c6a0
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/capi_value_c.c
@@ -0,0 +1,4 @@
+
+#include "capi_value_c.h"
+
+const int i = 23;
diff --git a/testsuite/tests/ffi/should_run/capi_value_c.h b/testsuite/tests/ffi/should_run/capi_value_c.h
new file mode 100644
index 0000000000..d8ef814216
--- /dev/null
+++ b/testsuite/tests/ffi/should_run/capi_value_c.h
@@ -0,0 +1,3 @@
+
+const int i;
+#define j 24