[commit: testsuite] master: Test Trac #8639 (b56bee2)
git at git.haskell.org
git at git.haskell.org
Fri Jan 3 16:16:11 UTC 2014
Repository : ssh://git@git.haskell.org/testsuite
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/b56bee2c2340f0ce8f6759e989093c18d7a7bd40/testsuite
>---------------------------------------------------------------
commit b56bee2c2340f0ce8f6759e989093c18d7a7bd40
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Thu Jan 2 15:18:10 2014 +0000
Test Trac #8639
>---------------------------------------------------------------
b56bee2c2340f0ce8f6759e989093c18d7a7bd40
tests/ghc-api/Makefile | 4 ++++
tests/ghc-api/T8639_api.hs | 26 ++++++++++++++++++++++++++
tests/ghc-api/T8639_api.stdout | 1 +
tests/ghc-api/T8639_api_a.hs | 3 +++
tests/ghc-api/all.T | 5 ++++-
5 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/tests/ghc-api/Makefile b/tests/ghc-api/Makefile
index 57ba15c..808990c 100644
--- a/tests/ghc-api/Makefile
+++ b/tests/ghc-api/Makefile
@@ -9,6 +9,10 @@ T6145: clean
'$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T6145
./T6145 "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`"
+T8639_api: clean
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T8639_api
+ ./T8639_api "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`"
+
.PHONY: clean T6145
diff --git a/tests/ghc-api/T8639_api.hs b/tests/ghc-api/T8639_api.hs
new file mode 100644
index 0000000..4232aa0
--- /dev/null
+++ b/tests/ghc-api/T8639_api.hs
@@ -0,0 +1,26 @@
+module Main where
+
+import GHC
+import GhcMonad
+import Outputable
+import System.IO
+import System.Environment( getArgs )
+
+main
+ = do { [libdir] <- getArgs
+ ; runGhc (Just libdir) $ do
+ flags <- getSessionDynFlags
+ setSessionDynFlags (flags{ hscTarget = HscInterpreted, ghcLink = LinkInMemory})
+ target <- guessTarget "T8639_api_a.hs" Nothing
+ setTargets [target]
+ load LoadAllTargets
+ imps <- mapM parseImportDecl ["import Prelude", "import T8639_api_a"]
+ setContext (map IIDecl imps)
+
+ -- With the next line, you get an "Not in scope" exception.
+ -- If you comment out this runStmt, it runs without error and prints the type.
+ runStmt "putStrLn (show 3)" RunToCompletion
+
+ ty <- exprType "T8639_api_a.it"
+ liftIO (putStrLn (showPpr flags ty))
+ ; hFlush stdout }
diff --git a/tests/ghc-api/T8639_api.stdout b/tests/ghc-api/T8639_api.stdout
new file mode 100644
index 0000000..3d957c1
--- /dev/null
+++ b/tests/ghc-api/T8639_api.stdout
@@ -0,0 +1 @@
+GHC.Types.Bool
diff --git a/tests/ghc-api/T8639_api_a.hs b/tests/ghc-api/T8639_api_a.hs
new file mode 100644
index 0000000..ed0d96d
--- /dev/null
+++ b/tests/ghc-api/T8639_api_a.hs
@@ -0,0 +1,3 @@
+module T8639_api_a where
+
+it = True
diff --git a/tests/ghc-api/all.T b/tests/ghc-api/all.T
index ee58181..998bcd7 100644
--- a/tests/ghc-api/all.T
+++ b/tests/ghc-api/all.T
@@ -1,4 +1,7 @@
+test('ghcApi', normal, compile_and_run, ['-package ghc'])
test('T6145', when(fast(), skip),
run_command,
['$MAKE -s --no-print-directory T6145'])
-test('ghcApi', normal, compile_and_run, ['-package ghc'])
+test('T8639_api', when(fast(), skip),
+ run_command,
+ ['$MAKE -s --no-print-directory T8639_api'])
More information about the ghc-commits
mailing list