Update examples
This commit is contained in:
3
testsuite/makewith/mergeto0/Bar.hs
Normal file
3
testsuite/makewith/mergeto0/Bar.hs
Normal file
@ -0,0 +1,3 @@
|
||||
module Bar where
|
||||
|
||||
resource :: Int
|
4
testsuite/makewith/mergeto0/Foo.hs
Normal file
4
testsuite/makewith/mergeto0/Foo.hs
Normal file
@ -0,0 +1,4 @@
|
||||
module Foo where
|
||||
|
||||
resource :: Integer
|
||||
resource = 0xBAD
|
37
testsuite/makewith/mergeto0/Main.hs
Normal file
37
testsuite/makewith/mergeto0/Main.hs
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
import System.Plugins
|
||||
|
||||
import System.Directory
|
||||
|
||||
a = "Foo.hs" -- uesr code
|
||||
b = "Bar.hs" -- trusted code. Result is "Bar.o"
|
||||
c = "Out.hs"
|
||||
|
||||
main = do
|
||||
status <- mergeTo a b c
|
||||
f <- case status of
|
||||
MergeFailure e -> error "mergeto failure"
|
||||
MergeSuccess _ _ f -> return f
|
||||
print $ f == c
|
||||
|
||||
status <- mergeTo a b c
|
||||
f' <- case status of
|
||||
MergeFailure e -> error "mergeto failure"
|
||||
MergeSuccess ReComp _ f -> error "unnec. mergeto"
|
||||
MergeSuccess NotReq _ f -> return f -- good, not req
|
||||
|
||||
print $ f == f' && f == c
|
||||
|
||||
status <- make f' []
|
||||
o <- case status of
|
||||
MakeFailure e -> error "make failed"
|
||||
MakeSuccess _ o -> return o
|
||||
|
||||
m_v <- load o [] [] "resource"
|
||||
v <- case m_v of
|
||||
LoadSuccess _ v -> return v
|
||||
_ -> error "load failed"
|
||||
putStrLn $ show $ (v :: Int)
|
||||
|
||||
makeCleaner c
|
||||
|
4
testsuite/makewith/mergeto0/Makefile
Normal file
4
testsuite/makewith/mergeto0/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
TEST=makewith/mergeto0
|
||||
|
||||
TOP=../../..
|
||||
include ../../eval.mk
|
3
testsuite/makewith/mergeto0/expected
Normal file
3
testsuite/makewith/mergeto0/expected
Normal file
@ -0,0 +1,3 @@
|
||||
True
|
||||
True
|
||||
2989
|
Reference in New Issue
Block a user