Update examples
This commit is contained in:
6
testsuite/load/load_0/Makefile
Normal file
6
testsuite/load/load_0/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
TEST= load/load_0
|
||||
|
||||
EXTRA_OBJS=Test.o
|
||||
|
||||
TOP=../../..
|
||||
include ../../build.mk
|
6
testsuite/load/load_0/Test.hs
Normal file
6
testsuite/load/load_0/Test.hs
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
module Test where
|
||||
|
||||
import API
|
||||
|
||||
resource = test { field = "success" }
|
8
testsuite/load/load_0/api/API.hs
Normal file
8
testsuite/load/load_0/api/API.hs
Normal file
@ -0,0 +1,8 @@
|
||||
module API where
|
||||
|
||||
data Test = Test {
|
||||
field :: String
|
||||
}
|
||||
|
||||
test :: Test
|
||||
test = Test { field = "default value" }
|
11
testsuite/load/load_0/prog/Main.hs
Normal file
11
testsuite/load/load_0/prog/Main.hs
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
import System.Plugins
|
||||
import API
|
||||
|
||||
main = do
|
||||
m_v <- load_ "../Test.o" ["../api"] "resource"
|
||||
v <- case m_v of
|
||||
LoadFailure _ -> error "load failed"
|
||||
LoadSuccess _ v -> return v
|
||||
let s = field v
|
||||
print s
|
1
testsuite/load/load_0/prog/expected
Normal file
1
testsuite/load/load_0/prog/expected
Normal file
@ -0,0 +1 @@
|
||||
"success"
|
Reference in New Issue
Block a user