Update examples
This commit is contained in:
5
testsuite/pdynload/should_fail1/Makefile
Normal file
5
testsuite/pdynload/should_fail1/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
# Missing class constraint... can't do that in Clean
|
||||
|
||||
TEST= pdynload/should_fail1
|
||||
TOP=../../..
|
||||
include ../../build.mk
|
5
testsuite/pdynload/should_fail1/Plugin.hs
Normal file
5
testsuite/pdynload/should_fail1/Plugin.hs
Normal file
@ -0,0 +1,5 @@
|
||||
module Plugin where
|
||||
|
||||
data I = I Int
|
||||
|
||||
resource = I 1
|
8
testsuite/pdynload/should_fail1/api/API.hs
Normal file
8
testsuite/pdynload/should_fail1/api/API.hs
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
module API where
|
||||
|
||||
newtype Interface = I Int
|
||||
|
||||
rsrc :: Interface
|
||||
rsrc = I 1
|
||||
|
17
testsuite/pdynload/should_fail1/prog/Main.hs
Normal file
17
testsuite/pdynload/should_fail1/prog/Main.hs
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
import System.Plugins
|
||||
import API
|
||||
|
||||
src = "../Plugin.hs"
|
||||
wrap = "../Wrapper.hs"
|
||||
apipath = "../api"
|
||||
|
||||
main = do status <- make src ["-i"++apipath]
|
||||
case status of
|
||||
MakeSuccess _ _ -> f
|
||||
MakeFailure e -> mapM_ putStrLn e
|
||||
|
||||
where f = do v <- pdynload "../Plugin.o" ["../api"] [] "API.Interface" "resource"
|
||||
case v of
|
||||
LoadSuccess _ a -> putStrLn "loaded .. yay!"
|
||||
_ -> putStrLn "wrong types"
|
1
testsuite/pdynload/should_fail1/prog/expected
Normal file
1
testsuite/pdynload/should_fail1/prog/expected
Normal file
@ -0,0 +1 @@
|
||||
wrong types
|
Reference in New Issue
Block a user