summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-10-05 19:17:20 +0100
committerIan Lynagh <igloo@earth.li>2011-10-05 19:17:20 +0100
commitb80cc02525a43c7a3fba85bb03e8acbd28211f57 (patch)
tree85ea604381184237b935bf07e165af8fe697dafc /testsuite
parenta40f26b29c4f6cf2100d4139a87b1de077661d6e (diff)
downloadhaskell-b80cc02525a43c7a3fba85bb03e8acbd28211f57.tar.gz
Add a test for dynCompileExpr
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghc-api/dynCompileExpr/Makefile13
-rw-r--r--testsuite/tests/ghc-api/dynCompileExpr/all.T4
-rw-r--r--testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.hs18
-rw-r--r--testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.stdout1
4 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-api/dynCompileExpr/Makefile b/testsuite/tests/ghc-api/dynCompileExpr/Makefile
new file mode 100644
index 0000000000..8ed1da5153
--- /dev/null
+++ b/testsuite/tests/ghc-api/dynCompileExpr/Makefile
@@ -0,0 +1,13 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+clean:
+ rm -f *.o *.hi
+
+dynCompileExpr: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc dynCompileExpr
+ ./dynCompileExpr "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`"
+
+.PHONY: clean dynCompileExpr
+
diff --git a/testsuite/tests/ghc-api/dynCompileExpr/all.T b/testsuite/tests/ghc-api/dynCompileExpr/all.T
new file mode 100644
index 0000000000..57962cfdf1
--- /dev/null
+++ b/testsuite/tests/ghc-api/dynCompileExpr/all.T
@@ -0,0 +1,4 @@
+test('dynCompileExpr',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory dynCompileExpr'])
diff --git a/testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.hs b/testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.hs
new file mode 100644
index 0000000000..9cdd3f0b7d
--- /dev/null
+++ b/testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.hs
@@ -0,0 +1,18 @@
+
+module Main where
+
+import GHC
+import MonadUtils
+
+import System.Environment
+
+main :: IO ()
+main = do [libdir] <- getArgs
+ runGhc (Just libdir) doit
+
+doit :: Ghc ()
+doit = do
+ getSessionDynFlags >>= setSessionDynFlags
+ dyn <- dynCompileExpr "()"
+ liftIO $ print dyn
+
diff --git a/testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.stdout b/testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.stdout
new file mode 100644
index 0000000000..e5f4ec87a4
--- /dev/null
+++ b/testsuite/tests/ghc-api/dynCompileExpr/dynCompileExpr.stdout
@@ -0,0 +1 @@
+<<()>>