diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-01-03 16:33:59 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-01-03 16:33:59 +0000 |
commit | de705b801a10c7f9a1c9a0db79582258b3379afc (patch) | |
tree | 172780a9d43ada99274fa2aaa921ff6a1a98e7a3 | |
parent | 7f2bf06ebfb53f75196ff285d3f4f741bba5459b (diff) | |
download | haskell-de705b801a10c7f9a1c9a0db79582258b3379afc.tar.gz |
Test Trac #8628
-rw-r--r-- | testsuite/tests/ghc-api/Makefile | 4 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/T8628.hs | 33 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/T8628.stdout | 3 | ||||
-rw-r--r-- | testsuite/tests/ghc-api/all.T | 3 |
4 files changed, 43 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-api/Makefile b/testsuite/tests/ghc-api/Makefile index 808990c909..855b7749a3 100644 --- a/testsuite/tests/ghc-api/Makefile +++ b/testsuite/tests/ghc-api/Makefile @@ -13,6 +13,10 @@ 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'`" +T8628: clean + '$(TEST_HC)' $(TEST_HC_OPTS) --make -v0 -package ghc T8628 + ./T8628 "`'$(TEST_HC)' $(TEST_HC_OPTS) --print-libdir | tr -d '\r'`" + .PHONY: clean T6145 diff --git a/testsuite/tests/ghc-api/T8628.hs b/testsuite/tests/ghc-api/T8628.hs new file mode 100644 index 0000000000..203d3282ab --- /dev/null +++ b/testsuite/tests/ghc-api/T8628.hs @@ -0,0 +1,33 @@ +module Main where + +import System.IO +import DynFlags +import GHC +import Exception +import Module +import FastString +import MonadUtils +import Outputable +import Bag (filterBag,isEmptyBag) +import System.Directory (removeFile) +import System.Environment( getArgs ) +import PrelNames + +main :: IO() +main + = do [libdir] <- getArgs + ok <- runGhc (Just libdir) $ do + dflags <- getSessionDynFlags + setSessionDynFlags dflags + liftIO (setUnsafeGlobalDynFlags dflags) + + setContext [ IIDecl (simpleImportDecl pRELUDE_NAME) + , IIDecl (simpleImportDecl (mkModuleNameFS (fsLit "System.IO")))] + runDecls "data X = Y ()" + runStmt "print True" RunToCompletion + gtry $ runStmt "print (Y ())" RunToCompletion :: GhcMonad m => m (Either SomeException RunResult) + runDecls "data X = Y () deriving Show" + _ <- dynCompileExpr "'x'" + runStmt "print (Y ())" RunToCompletion + runStmt "System.IO.hFlush System.IO.stdout" RunToCompletion + print "done" diff --git a/testsuite/tests/ghc-api/T8628.stdout b/testsuite/tests/ghc-api/T8628.stdout new file mode 100644 index 0000000000..d18820e5ff --- /dev/null +++ b/testsuite/tests/ghc-api/T8628.stdout @@ -0,0 +1,3 @@ +True +Y () +"done" diff --git a/testsuite/tests/ghc-api/all.T b/testsuite/tests/ghc-api/all.T index 998bcd711e..1f83dcdd3a 100644 --- a/testsuite/tests/ghc-api/all.T +++ b/testsuite/tests/ghc-api/all.T @@ -5,3 +5,6 @@ test('T6145', when(fast(), skip), test('T8639_api', when(fast(), skip), run_command, ['$MAKE -s --no-print-directory T8639_api']) +test('T8628', when(fast(), skip), + run_command, + ['$MAKE -s --no-print-directory T8628']) |