diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-08-26 16:18:33 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-09-01 11:15:28 +0100 |
commit | b38eae12c1c34ff29e568b35c5c85d21f5b9092c (patch) | |
tree | b4232058ddc6f38e4100322f7906e0583625a1dc /testsuite/tests/ghci | |
parent | b7aa8a83c792e899d2d20c61fe4eed88dced6848 (diff) | |
download | haskell-b38eae12c1c34ff29e568b35c5c85d21f5b9092c.tar.gz |
Add a test for ":show imports"
Diffstat (limited to 'testsuite/tests/ghci')
-rw-r--r-- | testsuite/tests/ghci/scripts/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci038.hs | 3 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci038.script | 42 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci038.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci038.stdout | 31 |
5 files changed, 81 insertions, 0 deletions
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 5be5582df0..9baf9edb85 100644 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -54,6 +54,7 @@ test('ghci034', normal, ghci_script, ['ghci034.script']) test('ghci035', normal, ghci_script, ['ghci035.script']) test('ghci036', normal, ghci_script, ['ghci036.script']) test('ghci037', req_interp, run_command, ['$MAKE -s --no-print-directory ghci037']) +test('ghci038', normal, ghci_script, ['ghci038.script']) test('2452', normal, ghci_script, ['2452.script']) test('T2766', normal, ghci_script, ['T2766.script']) diff --git a/testsuite/tests/ghci/scripts/ghci038.hs b/testsuite/tests/ghci/scripts/ghci038.hs new file mode 100644 index 0000000000..62b3318e25 --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci038.hs @@ -0,0 +1,3 @@ +module Foo where +import Data.List +x = map diff --git a/testsuite/tests/ghci/scripts/ghci038.script b/testsuite/tests/ghci/scripts/ghci038.script new file mode 100644 index 0000000000..1b01a031bb --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci038.script @@ -0,0 +1,42 @@ +-- Tests for ":show imports" and import/:module +:show imports +import Prelude +:show imports +:!echo -- map in scope due to explicit 'import Prelude' +:t map +import Prelude () +:show imports +:!echo -- still in scope, 'import Prelude ()' is subsumed by 'import Prelude' +:t map +:module -Prelude +:show imports +:!echo -- still in scope, implicit import of Prelude +:t map +import Prelude () +:show imports +:!echo -- not in scope now +:t map + +:module -Prelude +:show imports +:load ghci038.hs + +:t x +:show imports +:!echo :m -Foo +:m -Foo +:show imports +:t x +:!echo :m +*Foo +:m +*Foo +:show imports +:t x + +import Prelude +:show imports +import Data.List hiding (nub) +:show imports +import qualified Data.List as Q +:show imports +:m -Data.List +:show imports diff --git a/testsuite/tests/ghci/scripts/ghci038.stderr b/testsuite/tests/ghci/scripts/ghci038.stderr new file mode 100644 index 0000000000..5b3b85c25b --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci038.stderr @@ -0,0 +1,4 @@ + +<interactive>:1:1: Not in scope: `map' + +<interactive>:1:1: Not in scope: `x' diff --git a/testsuite/tests/ghci/scripts/ghci038.stdout b/testsuite/tests/ghci/scripts/ghci038.stdout new file mode 100644 index 0000000000..94b0613a1d --- /dev/null +++ b/testsuite/tests/ghci/scripts/ghci038.stdout @@ -0,0 +1,31 @@ +import Prelude -- implicit +import Prelude +-- map in scope due to explicit import Prelude +map :: (a -> b) -> [a] -> [b] +import Prelude +-- still in scope, import Prelude () is subsumed by import Prelude +map :: (a -> b) -> [a] -> [b] +import Prelude -- implicit +-- still in scope, implicit import of Prelude +map :: (a -> b) -> [a] -> [b] +import Prelude () +-- not in scope now +import Prelude -- implicit +x :: (a -> b) -> [a] -> [b] +:module +*Foo -- added automatically +:m -Foo +import Prelude -- implicit +:m +*Foo +:module +*Foo +x :: (a -> b) -> [a] -> [b] +:module +*Foo +import Prelude +:module +*Foo +import Prelude +import Data.List hiding ( nub ) +:module +*Foo +import Prelude +import Data.List hiding ( nub ) +import qualified Data.List as Q +:module +*Foo +import Prelude |