summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRik Steenkamp <rik@ewps.nl>2016-01-09 18:15:45 +0100
committerBen Gamari <ben@smart-cactus.org>2016-01-09 18:15:56 +0100
commita84c21ebaa5c56a222d69f245ef4daa77054fdcb (patch)
tree8caf065006ea917f0a7407ba7c55258ad2f39fa1 /testsuite
parent0dc230879ae2f8b7f6d97779631ba0847e415f24 (diff)
downloadhaskell-a84c21ebaa5c56a222d69f245ef4daa77054fdcb.tar.gz
Reject import declaration with semicolon in GHCi
Now GHCi rejects input containing an import declaration and semicolon, and prints an appropriate error message. Before, the stuff after an import declaration and semicolon got ignored (most of the time), without telling the user about it. As the default behaviour of GHCi is to reject multiple commands in a single input, we extend this behaviour to import commands. This patch fixes #10663. (See https://phabricator.haskell.org/D1518 for the introduction of `is_import` and `is_decl`.) Reviewers: austin, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1726 GHC Trac Issues: #10663
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/ghci/scripts/T10663.script1
-rw-r--r--testsuite/tests/ghci/scripts/T10663.stderr1
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T1
3 files changed, 3 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/T10663.script b/testsuite/tests/ghci/scripts/T10663.script
new file mode 100644
index 0000000000..10be57f52a
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T10663.script
@@ -0,0 +1 @@
+import Data.List; sort [2, 1] \ No newline at end of file
diff --git a/testsuite/tests/ghci/scripts/T10663.stderr b/testsuite/tests/ghci/scripts/T10663.stderr
new file mode 100644
index 0000000000..7170dbf29c
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T10663.stderr
@@ -0,0 +1 @@
+error: expecting a single import declaration \ No newline at end of file
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index da0ea0d55e..06a91259a8 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -225,6 +225,7 @@ test('T10466', normal, ghci_script, ['T10466.script'])
test('T10501', normal, ghci_script, ['T10501.script'])
test('T10508', normal, ghci_script, ['T10508.script'])
test('T10520', normal, ghci_script, ['T10520.script'])
+test('T10663', normal, ghci_script, ['T10663.script'])
test('T10989',
[
extra_clean(['dummy.hs', 'dummy.lhs', 'dummy.tags'])