summaryrefslogtreecommitdiff
path: root/testsuite/tests/rename/prog006
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rename/prog006')
-rw-r--r--testsuite/tests/rename/prog006/A.hs9
-rw-r--r--testsuite/tests/rename/prog006/B/C.hs5
-rw-r--r--testsuite/tests/rename/prog006/Main.hs7
-rw-r--r--testsuite/tests/rename/prog006/Makefile39
-rw-r--r--testsuite/tests/rename/prog006/Setup.lhs5
-rw-r--r--testsuite/tests/rename/prog006/all.T7
-rw-r--r--testsuite/tests/rename/prog006/pwd.hs12
-rw-r--r--testsuite/tests/rename/prog006/rn.prog006.stderr0
-rw-r--r--testsuite/tests/rename/prog006/test.cabal4
9 files changed, 88 insertions, 0 deletions
diff --git a/testsuite/tests/rename/prog006/A.hs b/testsuite/tests/rename/prog006/A.hs
new file mode 100644
index 0000000000..52e442a0c2
--- /dev/null
+++ b/testsuite/tests/rename/prog006/A.hs
@@ -0,0 +1,9 @@
+module A (f, y) where
+
+import B.C (T(..))
+
+f (T x) = x
+
+y = T 42
+
+
diff --git a/testsuite/tests/rename/prog006/B/C.hs b/testsuite/tests/rename/prog006/B/C.hs
new file mode 100644
index 0000000000..ece50b9002
--- /dev/null
+++ b/testsuite/tests/rename/prog006/B/C.hs
@@ -0,0 +1,5 @@
+module B.C where
+
+newtype T = T Int
+ deriving Show
+
diff --git a/testsuite/tests/rename/prog006/Main.hs b/testsuite/tests/rename/prog006/Main.hs
new file mode 100644
index 0000000000..13f7265fc4
--- /dev/null
+++ b/testsuite/tests/rename/prog006/Main.hs
@@ -0,0 +1,7 @@
+module Main (main, z) where
+
+import A
+
+main = print (f y)
+
+z = y
diff --git a/testsuite/tests/rename/prog006/Makefile b/testsuite/tests/rename/prog006/Makefile
new file mode 100644
index 0000000000..1e643fd6fb
--- /dev/null
+++ b/testsuite/tests/rename/prog006/Makefile
@@ -0,0 +1,39 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Original comments relating to GHC 6.4:
+# This test caused a panic in GHC 6.4, but in reality it is user
+# error, caused by compiling separate modules in the program using
+# different search paths. GHC gets confused when it can't find a
+# module mentioned as a dependency in another interface file.
+
+# Update for GHC 6.6:
+# This test now succeeds, because A.hi records the fact that B.C
+# came from the package test-1.0, so there's no conflict.
+
+# If the package format changes, we might have to re-generate pkg.conf
+# using the supplied Cabal configuration.
+
+LOCAL_PKGCONF=local.package.conf
+LOCAL_GHC_PKG = '$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF)
+
+rn.prog006:
+ rm -f A.hi A.o B/C.hi B/C.o Main.hi Main.o pkg.conf
+ rm -f pwd pwd.exe pwd.exe.manifest pwd.hi pwd.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make pwd -v0
+ '$(TEST_HC)' $(TEST_HC_OPTS) --make -package-name test-1.0 B.C -fforce-recomp -v0
+ rm -f pkg.conf
+ echo "name: test" >>pkg.conf
+ echo "version: 1.0" >>pkg.conf
+ echo "id: test-XXX" >>pkg.conf
+ echo "import-dirs: `./pwd`" >>pkg.conf
+ echo "exposed-modules: B.C" >>pkg.conf
+ echo "[]" >$(LOCAL_PKGCONF)
+ $(LOCAL_GHC_PKG) register pkg.conf -v0
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -package-conf $(LOCAL_PKGCONF) -package test -fforce-recomp A.hs -i
+# The -i clears the search path, so A.hs will find B.C from package test
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -c -package-conf $(LOCAL_PKGCONF) -package test -fforce-recomp Main.hs
+# No -i when compiling Main, so a from-scratch search would find a home-pkg module B.C
+# However, A.hi remembers that B.C came from package test, so all is ok.
+
diff --git a/testsuite/tests/rename/prog006/Setup.lhs b/testsuite/tests/rename/prog006/Setup.lhs
new file mode 100644
index 0000000000..b28a8234f9
--- /dev/null
+++ b/testsuite/tests/rename/prog006/Setup.lhs
@@ -0,0 +1,5 @@
+#!/usr/bin/runhaskell
+> module Main where
+> import Distribution.Simple
+> main :: IO ()
+> main = defaultMain
diff --git a/testsuite/tests/rename/prog006/all.T b/testsuite/tests/rename/prog006/all.T
new file mode 100644
index 0000000000..4126e6cdf4
--- /dev/null
+++ b/testsuite/tests/rename/prog006/all.T
@@ -0,0 +1,7 @@
+test('rn.prog006',
+ extra_clean(['A.hi', 'A.o', 'B/C.hi', 'B/C.o',
+ 'Main.hi', 'Main.o', 'pkg.conf',
+ 'pwd', 'pwd.exe', 'pwd.exe.manifest',
+ 'pwd.hi', 'pwd.o']),
+ run_command,
+ ['$MAKE -s --no-print-directory rn.prog006'])
diff --git a/testsuite/tests/rename/prog006/pwd.hs b/testsuite/tests/rename/prog006/pwd.hs
new file mode 100644
index 0000000000..177e836fe1
--- /dev/null
+++ b/testsuite/tests/rename/prog006/pwd.hs
@@ -0,0 +1,12 @@
+
+module Main where
+
+import System.Directory
+import System.Environment
+
+main :: IO ()
+main = do d <- getCurrentDirectory
+ putStr $ concatMap f d
+ where f '\\' = "/"
+ f c = [c]
+
diff --git a/testsuite/tests/rename/prog006/rn.prog006.stderr b/testsuite/tests/rename/prog006/rn.prog006.stderr
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuite/tests/rename/prog006/rn.prog006.stderr
diff --git a/testsuite/tests/rename/prog006/test.cabal b/testsuite/tests/rename/prog006/test.cabal
new file mode 100644
index 0000000000..64fb00e11a
--- /dev/null
+++ b/testsuite/tests/rename/prog006/test.cabal
@@ -0,0 +1,4 @@
+name: test
+version: 1.0
+exposed-modules: B.C
+