Update examples
This commit is contained in:
25
testsuite/hier/hier3/Main.hs
Normal file
25
testsuite/hier/hier3/Main.hs
Normal file
@ -0,0 +1,25 @@
|
||||
module Main where
|
||||
|
||||
import System.Plugins
|
||||
|
||||
main = do
|
||||
|
||||
makeAll "One.hs" []
|
||||
|
||||
load2 "Two.o"
|
||||
|
||||
load2 "./Two.o" -- shouldn't load
|
||||
load2 "../hier3/Two.o" -- shouldn't load
|
||||
load2 "././././Two.o" -- shouldn't load
|
||||
|
||||
-- and this one pulls in "../hier3/Two.o" as a dep
|
||||
y <- load "One.o" ["../hier3"] [] "resource"
|
||||
case y of
|
||||
LoadSuccess _ s -> putStrLn $ "One plugin: " ++ s
|
||||
LoadFailure _ -> putStrLn "Failure: y"
|
||||
|
||||
load2 f = do
|
||||
x <- load f [".", "../hier3", ""] [] "resource" -- depend on One.o
|
||||
case x of
|
||||
LoadSuccess _ s -> putStrLn $ "Two plugin: " ++ s
|
||||
LoadFailure _ -> putStrLn "Failure: x"
|
7
testsuite/hier/hier3/Makefile
Normal file
7
testsuite/hier/hier3/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
TEST= hier/hier3
|
||||
|
||||
EXTRA_OBJS=One.o Two.o
|
||||
EXTRAFLAGS=
|
||||
|
||||
TOP=../../..
|
||||
include ../../eval.mk
|
7
testsuite/hier/hier3/One.hs
Normal file
7
testsuite/hier/hier3/One.hs
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
module One where
|
||||
|
||||
import qualified Two
|
||||
|
||||
resource = "This is the sub-plugin of (" ++ Two.resource ++ ")"
|
||||
|
4
testsuite/hier/hier3/Two.hs
Normal file
4
testsuite/hier/hier3/Two.hs
Normal file
@ -0,0 +1,4 @@
|
||||
module Two where
|
||||
|
||||
resource = "This is the top plugin"
|
||||
|
5
testsuite/hier/hier3/expected
Normal file
5
testsuite/hier/hier3/expected
Normal file
@ -0,0 +1,5 @@
|
||||
Two plugin: This is the top plugin
|
||||
Two plugin: This is the top plugin
|
||||
Two plugin: This is the top plugin
|
||||
Two plugin: This is the top plugin
|
||||
One plugin: This is the sub-plugin of (This is the top plugin)
|
Reference in New Issue
Block a user