[commit: testsuite] master: Add a test that you can't import "value"s using ccall (81a874f)
Ian Lynagh
igloo at earth.li
Sun Feb 26 16:13:38 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/testsuite
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/81a874fa1833ef829bae7781fc9659c1f5ef9db9
>---------------------------------------------------------------
commit 81a874fa1833ef829bae7781fc9659c1f5ef9db9
Author: Ian Lynagh <igloo at earth.li>
Date: Sun Feb 26 01:00:59 2012 +0000
Add a test that you can't import "value"s using ccall
"value"s can only be imported using capi.
>---------------------------------------------------------------
tests/ffi/should_fail/all.T | 1 +
tests/ffi/should_fail/ccall_value.hs | 12 ++++++++++++
tests/ffi/should_fail/ccall_value.stderr | 2 ++
.../capi_value_c.h => should_fail/ccall_value_c.h} | 0
4 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/tests/ffi/should_fail/all.T b/tests/ffi/should_fail/all.T
index abba1b5..ca79a89 100644
--- a/tests/ffi/should_fail/all.T
+++ b/tests/ffi/should_fail/all.T
@@ -8,3 +8,4 @@ test('ccfail003', only_compiler_types(['ghc']), compile_fail, [''])
test('T3066', only_compiler_types(['ghc']), compile_fail, [''])
test('ccfail004', only_compiler_types(['ghc']), multimod_compile_fail, ['ccfail004', '-v0'])
test('ccfail005', only_compiler_types(['ghc']), compile_fail, [''])
+test('ccall_value', normal, compile_fail, [''])
diff --git a/tests/ffi/should_fail/ccall_value.hs b/tests/ffi/should_fail/ccall_value.hs
new file mode 100644
index 0000000..2f931f6
--- /dev/null
+++ b/tests/ffi/should_fail/ccall_value.hs
@@ -0,0 +1,12 @@
+
+{-# LANGUAGE CApiFFI #-}
+
+module Main (main) where
+
+import Foreign.C
+
+main :: IO ()
+main = print i
+
+foreign import ccall "ccall_value_c.h value i" i :: CInt
+
diff --git a/tests/ffi/should_fail/ccall_value.stderr b/tests/ffi/should_fail/ccall_value.stderr
new file mode 100644
index 0000000..b7e870f
--- /dev/null
+++ b/tests/ffi/should_fail/ccall_value.stderr
@@ -0,0 +1,2 @@
+
+ccall_value.hs:11:22: Malformed entity string
diff --git a/tests/ffi/should_run/capi_value_c.h b/tests/ffi/should_fail/ccall_value_c.h
similarity index 100%
copy from tests/ffi/should_run/capi_value_c.h
copy to tests/ffi/should_fail/ccall_value_c.h
More information about the Cvs-ghc
mailing list