summaryrefslogtreecommitdiff
path: root/testsuite/tests/layout
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-07-20 11:09:03 -0700
committerDavid Terei <davidterei@gmail.com>2011-07-20 11:26:35 -0700
commit16514f272fb42af6e9c7674a9bd6c9dce369231f (patch)
treee4f332b45fe65e2a7a2451be5674f887b42bf199 /testsuite/tests/layout
parentebd422aed41048476aa61dd4c520d43becd78682 (diff)
downloadhaskell-16514f272fb42af6e9c7674a9bd6c9dce369231f.tar.gz
Move tests from tests/ghc-regress/* to just tests/*
Diffstat (limited to 'testsuite/tests/layout')
-rw-r--r--testsuite/tests/layout/Makefile15
-rw-r--r--testsuite/tests/layout/all.T57
-rw-r--r--testsuite/tests/layout/layout001.hs6
-rw-r--r--testsuite/tests/layout/layout001.stdout9
-rw-r--r--testsuite/tests/layout/layout002.hs5
-rw-r--r--testsuite/tests/layout/layout002.stdout3
-rw-r--r--testsuite/tests/layout/layout003.hs12
-rw-r--r--testsuite/tests/layout/layout003.stdout9
-rw-r--r--testsuite/tests/layout/layout004.hs10
-rw-r--r--testsuite/tests/layout/layout004.stdout7
-rw-r--r--testsuite/tests/layout/layout005.hs10
-rw-r--r--testsuite/tests/layout/layout005.stdout3
-rw-r--r--testsuite/tests/layout/layout006.hs13
-rw-r--r--testsuite/tests/layout/layout006.stdout9
-rw-r--r--testsuite/tests/layout/layout007.hs11
-rw-r--r--testsuite/tests/layout/layout007.stdout3
-rw-r--r--testsuite/tests/layout/layout008.hs22
-rw-r--r--testsuite/tests/layout/layout008.stdout3
-rw-r--r--testsuite/tests/layout/layout009.hs6
-rw-r--r--testsuite/tests/layout/layout009.stdout3
20 files changed, 216 insertions, 0 deletions
diff --git a/testsuite/tests/layout/Makefile b/testsuite/tests/layout/Makefile
new file mode 100644
index 0000000000..c87b830cab
--- /dev/null
+++ b/testsuite/tests/layout/Makefile
@@ -0,0 +1,15 @@
+TOP=../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+layout001 layout002 layout003 layout004 layout005 layout006 layout007 layout008 layout009: %:
+ $(RM) $*.hi $*.o
+ echo Running with -XNoAlternativeLayoutRule
+ -"$(TEST_HC)" $(TEST_HC_OPTS) -v0 -XNoAlternativeLayoutRule -c $*.hs 2>&1
+ $(RM) $*.hi $*.o
+ echo Running with -XAlternativeLayoutRule
+ -"$(TEST_HC)" $(TEST_HC_OPTS) -v0 -XAlternativeLayoutRule -c $*.hs 2>&1
+ $(RM) $*.hi $*.o
+ echo Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
+ -"$(TEST_HC)" $(TEST_HC_OPTS) -v0 -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional -c $*.hs 2>&1
+
diff --git a/testsuite/tests/layout/all.T b/testsuite/tests/layout/all.T
new file mode 100644
index 0000000000..026ad465a0
--- /dev/null
+++ b/testsuite/tests/layout/all.T
@@ -0,0 +1,57 @@
+
+test('layout001',
+ [extra_clean(['layout001.hi', 'layout001.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout001'])
+
+test('layout002',
+ [extra_clean(['layout002.hi', 'layout002.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout002'])
+
+test('layout003',
+ [extra_clean(['layout003.hi', 'layout003.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout003'])
+
+test('layout004',
+ [extra_clean(['layout004.hi', 'layout004.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout004'])
+
+test('layout005',
+ [extra_clean(['layout005.hi', 'layout005.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout005'])
+
+test('layout006',
+ [extra_clean(['layout006.hi', 'layout006.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout006'])
+
+test('layout007',
+ [req_interp,
+ extra_clean(['layout007.hi', 'layout007.o']),
+ only_compiler_types(['ghc']),
+ if_compiler_profiled(skip)],
+ run_command,
+ ['$MAKE -s --no-print-directory layout007'])
+
+test('layout008',
+ [extra_clean(['layout008.hi', 'layout008.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout008'])
+
+test('layout009',
+ [extra_clean(['layout009.hi', 'layout009.o']),
+ only_compiler_types(['ghc'])],
+ run_command,
+ ['$MAKE -s --no-print-directory layout009'])
+
diff --git a/testsuite/tests/layout/layout001.hs b/testsuite/tests/layout/layout001.hs
new file mode 100644
index 0000000000..1bf76fd859
--- /dev/null
+++ b/testsuite/tests/layout/layout001.hs
@@ -0,0 +1,6 @@
+
+module M where
+
+f = case () of
+ () -> ()
+ where x = x
diff --git a/testsuite/tests/layout/layout001.stdout b/testsuite/tests/layout/layout001.stdout
new file mode 100644
index 0000000000..be1cd62b20
--- /dev/null
+++ b/testsuite/tests/layout/layout001.stdout
@@ -0,0 +1,9 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+
+layout001.hs:6:3: parse error on input `where'
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
+
+layout001.hs:6:3:
+ transitional layout will not be accepted in the future:
+ `where' clause at the same depth as implicit layout block
diff --git a/testsuite/tests/layout/layout002.hs b/testsuite/tests/layout/layout002.hs
new file mode 100644
index 0000000000..17f895e092
--- /dev/null
+++ b/testsuite/tests/layout/layout002.hs
@@ -0,0 +1,5 @@
+
+module M where
+
+f = if True then do undefined else undefined
+
diff --git a/testsuite/tests/layout/layout002.stdout b/testsuite/tests/layout/layout002.stdout
new file mode 100644
index 0000000000..7197cdaa39
--- /dev/null
+++ b/testsuite/tests/layout/layout002.stdout
@@ -0,0 +1,3 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
diff --git a/testsuite/tests/layout/layout003.hs b/testsuite/tests/layout/layout003.hs
new file mode 100644
index 0000000000..d9a99afdcb
--- /dev/null
+++ b/testsuite/tests/layout/layout003.hs
@@ -0,0 +1,12 @@
+
+module M where
+
+-- The array package used to have things in this sort of pattern, where
+-- the "parse error" rule is needed to close the do block's layout
+
+f :: [IO ()]
+f = [do
+ undefined
+ undefined
+ | _ <- undefined]
+
diff --git a/testsuite/tests/layout/layout003.stdout b/testsuite/tests/layout/layout003.stdout
new file mode 100644
index 0000000000..e40bac2077
--- /dev/null
+++ b/testsuite/tests/layout/layout003.stdout
@@ -0,0 +1,9 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+
+layout003.hs:11:4: parse error on input `|'
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
+
+layout003.hs:11:4:
+ transitional layout will not be accepted in the future:
+ `|' at the same depth as implicit layout block
diff --git a/testsuite/tests/layout/layout004.hs b/testsuite/tests/layout/layout004.hs
new file mode 100644
index 0000000000..46e47b13bd
--- /dev/null
+++ b/testsuite/tests/layout/layout004.hs
@@ -0,0 +1,10 @@
+
+{-# LANGUAGE PatternGuards #-}
+
+module M where
+
+f | Just x <- undefined,
+ let y = x,
+ undefined x y
+ = ()
+
diff --git a/testsuite/tests/layout/layout004.stdout b/testsuite/tests/layout/layout004.stdout
new file mode 100644
index 0000000000..bb5cb0661b
--- /dev/null
+++ b/testsuite/tests/layout/layout004.stdout
@@ -0,0 +1,7 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+
+layout004.hs:7:14: parse error on input `,'
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
+
+layout004.hs:7:14: parse error on input `,'
diff --git a/testsuite/tests/layout/layout005.hs b/testsuite/tests/layout/layout005.hs
new file mode 100644
index 0000000000..df68795665
--- /dev/null
+++ b/testsuite/tests/layout/layout005.hs
@@ -0,0 +1,10 @@
+
+module M where
+
+-- GHC's Lexer.x had a piece of code like this
+
+f = if True then do
+ case () of
+ () -> ()
+ else ()
+
diff --git a/testsuite/tests/layout/layout005.stdout b/testsuite/tests/layout/layout005.stdout
new file mode 100644
index 0000000000..7197cdaa39
--- /dev/null
+++ b/testsuite/tests/layout/layout005.stdout
@@ -0,0 +1,3 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
diff --git a/testsuite/tests/layout/layout006.hs b/testsuite/tests/layout/layout006.hs
new file mode 100644
index 0000000000..70eacb42cf
--- /dev/null
+++ b/testsuite/tests/layout/layout006.hs
@@ -0,0 +1,13 @@
+
+module M where
+
+-- GHC's RdrHsSyn.lhs had a piece of code like this
+
+f :: IO ()
+f
+ | True = do
+ let x = ()
+ y = ()
+ return ()
+ | True = return ()
+
diff --git a/testsuite/tests/layout/layout006.stdout b/testsuite/tests/layout/layout006.stdout
new file mode 100644
index 0000000000..ab33a6e1fe
--- /dev/null
+++ b/testsuite/tests/layout/layout006.stdout
@@ -0,0 +1,9 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+
+layout006.hs:12:2: parse error on input `|'
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
+
+layout006.hs:12:2:
+ transitional layout will not be accepted in the future:
+ `|' at the same depth as implicit layout block
diff --git a/testsuite/tests/layout/layout007.hs b/testsuite/tests/layout/layout007.hs
new file mode 100644
index 0000000000..f620bdb2e8
--- /dev/null
+++ b/testsuite/tests/layout/layout007.hs
@@ -0,0 +1,11 @@
+
+{-# LANGUAGE TemplateHaskell #-}
+
+module M where
+
+-- The paren here closes the open-splice - it doesn't match an
+-- opening paren
+
+f :: IO ()
+f = do print $( [| 'a' |] )
+
diff --git a/testsuite/tests/layout/layout007.stdout b/testsuite/tests/layout/layout007.stdout
new file mode 100644
index 0000000000..7197cdaa39
--- /dev/null
+++ b/testsuite/tests/layout/layout007.stdout
@@ -0,0 +1,3 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
diff --git a/testsuite/tests/layout/layout008.hs b/testsuite/tests/layout/layout008.hs
new file mode 100644
index 0000000000..e484ebe44c
--- /dev/null
+++ b/testsuite/tests/layout/layout008.hs
@@ -0,0 +1,22 @@
+
+{-# LANGUAGE RecursiveDo, DoRec #-}
+{-# OPTIONS_GHC -fno-warn-deprecated-flags #-}
+
+module M where
+
+-- do, mdo and rec should all open layouts
+
+f :: IO ()
+f = do print 'a'
+ print 'b'
+
+g :: IO ()
+g = mdo print 'a'
+ print 'b'
+
+h :: IO ()
+h = do print 'a'
+ rec print 'b'
+ print 'c'
+ print 'd'
+
diff --git a/testsuite/tests/layout/layout008.stdout b/testsuite/tests/layout/layout008.stdout
new file mode 100644
index 0000000000..7197cdaa39
--- /dev/null
+++ b/testsuite/tests/layout/layout008.stdout
@@ -0,0 +1,3 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional
diff --git a/testsuite/tests/layout/layout009.hs b/testsuite/tests/layout/layout009.hs
new file mode 100644
index 0000000000..5383a4d80e
--- /dev/null
+++ b/testsuite/tests/layout/layout009.hs
@@ -0,0 +1,6 @@
+
+module M where
+
+f :: Char
+f = let {x = 'a'} in x
+
diff --git a/testsuite/tests/layout/layout009.stdout b/testsuite/tests/layout/layout009.stdout
new file mode 100644
index 0000000000..7197cdaa39
--- /dev/null
+++ b/testsuite/tests/layout/layout009.stdout
@@ -0,0 +1,3 @@
+Running with -XNoAlternativeLayoutRule
+Running with -XAlternativeLayoutRule
+Running with -XAlternativeLayoutRule -XAlternativeLayoutRuleTransitional