Update examples
This commit is contained in:
4
testsuite/makewith/should_fail_0/Makefile
Normal file
4
testsuite/makewith/should_fail_0/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
TEST=makewith/should_fail_0
|
||||
|
||||
TOP=../../..
|
||||
include ../../build.mk
|
3
testsuite/makewith/should_fail_0/Plugin.in
Normal file
3
testsuite/makewith/should_fail_0/Plugin.in
Normal file
@ -0,0 +1,3 @@
|
||||
module Plugin where
|
||||
|
||||
resource = 0xBAD :: Int
|
6
testsuite/makewith/should_fail_0/Plugin.stub
Normal file
6
testsuite/makewith/should_fail_0/Plugin.stub
Normal file
@ -0,0 +1,6 @@
|
||||
module Plugin ( resource ) where
|
||||
|
||||
import API
|
||||
|
||||
resource :: Interface
|
||||
resource = plugin
|
10
testsuite/makewith/should_fail_0/api/API.hs
Normal file
10
testsuite/makewith/should_fail_0/api/API.hs
Normal file
@ -0,0 +1,10 @@
|
||||
|
||||
module API where
|
||||
|
||||
data Interface = Interface {
|
||||
function :: String
|
||||
}
|
||||
|
||||
plugin :: Interface
|
||||
plugin = Interface { function = "goodbye" }
|
||||
|
19
testsuite/makewith/should_fail_0/prog/Main.hs
Normal file
19
testsuite/makewith/should_fail_0/prog/Main.hs
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
import System.Plugins
|
||||
import API
|
||||
|
||||
conf = "../Plugin.in"
|
||||
stub = "../Plugin.stub"
|
||||
|
||||
main = do
|
||||
status <- makeWith conf stub ["-i../api"]
|
||||
case status of
|
||||
MakeFailure e -> putStrLn "make failed"
|
||||
MakeSuccess _ o -> do
|
||||
m_v <- load o ["../api"] [] "resource"
|
||||
v <- case m_v of
|
||||
LoadSuccess _ v -> return v
|
||||
_ -> error "load failed"
|
||||
putStrLn $ (function v)
|
||||
makeCleaner o
|
||||
|
1
testsuite/makewith/should_fail_0/prog/expected
Normal file
1
testsuite/makewith/should_fail_0/prog/expected
Normal file
@ -0,0 +1 @@
|
||||
make failed
|
Reference in New Issue
Block a user