summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-e
diff options
context:
space:
mode:
authorReid Barton <rwbarton@gmail.com>2014-12-23 16:16:29 -0500
committerReid Barton <rwbarton@gmail.com>2014-12-23 16:16:29 -0500
commitcc510b46b4f6046115cd74acc2c8726c91823bcf (patch)
treeb52fb8532fde8d9b69f9251ffb4a090e58590856 /testsuite/tests/ghc-e
parent878910e1c4520732ab9d8372c1c81f00d484e48f (diff)
downloadhaskell-cc510b46b4f6046115cd74acc2c8726c91823bcf.tar.gz
Make ghc -e fail on invalid declarations
Summary: Note: This commit includes an API change to GhciMonad.runDecls to allow the caller to determine whether the declarations were run successfully or not. Test Plan: harbormaster Reviewers: austin Reviewed By: austin Subscribers: carter, thomie Differential Revision: https://phabricator.haskell.org/D582
Diffstat (limited to 'testsuite/tests/ghc-e')
-rw-r--r--testsuite/tests/ghc-e/should_fail/Makefile6
-rw-r--r--testsuite/tests/ghc-e/should_fail/all.T6
-rw-r--r--testsuite/tests/ghc-e/should_run/Makefile3
-rw-r--r--testsuite/tests/ghc-e/should_run/all.T1
-rw-r--r--testsuite/tests/ghc-e/should_run/ghc-e006.stdout1
5 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/ghc-e/should_fail/Makefile b/testsuite/tests/ghc-e/should_fail/Makefile
index 7a02f7bea3..c0cebcd546 100644
--- a/testsuite/tests/ghc-e/should_fail/Makefile
+++ b/testsuite/tests/ghc-e/should_fail/Makefile
@@ -13,3 +13,9 @@ T9905fail2:
T9905fail3:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Prelude (+)" # syntax error
+
+ghc-e-fail1:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "class ["
+
+ghc-e-fail2:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "type A = A"
diff --git a/testsuite/tests/ghc-e/should_fail/all.T b/testsuite/tests/ghc-e/should_fail/all.T
index 07dc614eab..bfd4a8a0f1 100644
--- a/testsuite/tests/ghc-e/should_fail/all.T
+++ b/testsuite/tests/ghc-e/should_fail/all.T
@@ -11,3 +11,9 @@ test('T9905fail2', [exit_code(2), req_interp, ignore_output], run_command,
test('T9905fail3', [exit_code(2), req_interp, ignore_output], run_command,
['$MAKE --no-print-directory -s T9905fail3'])
+
+test('ghc-e-fail1', [exit_code(2), req_interp, ignore_output], run_command,
+ ['$MAKE --no-print-directory -s ghc-e-fail1'])
+
+test('ghc-e-fail2', [exit_code(2), req_interp, ignore_output], run_command,
+ ['$MAKE --no-print-directory -s ghc-e-fail2'])
diff --git a/testsuite/tests/ghc-e/should_run/Makefile b/testsuite/tests/ghc-e/should_run/Makefile
index aa7041bc13..54ce8a31cc 100644
--- a/testsuite/tests/ghc-e/should_run/Makefile
+++ b/testsuite/tests/ghc-e/should_run/Makefile
@@ -18,6 +18,9 @@ ghc-e004:
ghc-e005:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -main-is foo ghc-e005.hs -e ":set prog ghc-e005-prog" -e ":main [\"the\",\"args\"]"; echo $$?
+ghc-e006:
+ '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "data X = X deriving Show" -e "X"
+
T2228:
'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e ":main" T2228.hs
diff --git a/testsuite/tests/ghc-e/should_run/all.T b/testsuite/tests/ghc-e/should_run/all.T
index 329ceea7f7..0e6f7f9c17 100644
--- a/testsuite/tests/ghc-e/should_run/all.T
+++ b/testsuite/tests/ghc-e/should_run/all.T
@@ -6,6 +6,7 @@ test('ghc-e002', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e0
test('ghc-e003', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e003'])
test('ghc-e004', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e004'])
test('ghc-e005', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e005'])
+test('ghc-e006', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e006'])
test('T2228',
[req_interp, when(ghci_dynamic(), expect_broken(7298))],
diff --git a/testsuite/tests/ghc-e/should_run/ghc-e006.stdout b/testsuite/tests/ghc-e/should_run/ghc-e006.stdout
new file mode 100644
index 0000000000..62d8fe9f6d
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_run/ghc-e006.stdout
@@ -0,0 +1 @@
+X