From f2ffb8f054fb2249ec69b34ccb00720fea7f1101 Mon Sep 17 00:00:00 2001
From: simonpj <unknown>
Date: Mon, 26 Jun 2000 16:09:40 +0000
Subject: [PATCH] [project @ 2000-06-26 16:09:40 by simonpj] Add test for
 filterFB

---
 ghc/tests/simplCore/should_run/Makefile          |  9 +++++++++
 ghc/tests/simplCore/should_run/simplrun001.hs    | 16 ++++++++++++++++
 .../simplCore/should_run/simplrun001.stderr      |  2 ++
 .../simplCore/should_run/simplrun001.stdout      |  1 +
 4 files changed, 28 insertions(+)
 create mode 100644 ghc/tests/simplCore/should_run/Makefile
 create mode 100644 ghc/tests/simplCore/should_run/simplrun001.hs
 create mode 100644 ghc/tests/simplCore/should_run/simplrun001.stderr
 create mode 100644 ghc/tests/simplCore/should_run/simplrun001.stdout

diff --git a/ghc/tests/simplCore/should_run/Makefile b/ghc/tests/simplCore/should_run/Makefile
new file mode 100644
index 000000000000..7ec3806836b4
--- /dev/null
+++ b/ghc/tests/simplCore/should_run/Makefile
@@ -0,0 +1,9 @@
+TOP = ../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/should_run.mk
+
+SRC_HC_OPTS += -dcore-lint
+
+include $(TOP)/mk/target.mk
+
+
diff --git a/ghc/tests/simplCore/should_run/simplrun001.hs b/ghc/tests/simplCore/should_run/simplrun001.hs
new file mode 100644
index 000000000000..f0b02c1db99f
--- /dev/null
+++ b/ghc/tests/simplCore/should_run/simplrun001.hs
@@ -0,0 +1,16 @@
+{-# OPTIONS -O #-}
+
+-- !!! Test filter fusion
+
+-- In GHC 4.06, the filterFB rule was back to front, which
+-- made this program hit the "error foo" case instead of
+-- working fine.
+
+
+module Main where
+
+main :: IO ()
+main = print (length (filter (not . foo)
+                             (filter (const False) [Nothing])))
+  where foo (Just x) = x
+        foo _        = error "foo"
diff --git a/ghc/tests/simplCore/should_run/simplrun001.stderr b/ghc/tests/simplCore/should_run/simplrun001.stderr
new file mode 100644
index 000000000000..317bd0ddf5dc
--- /dev/null
+++ b/ghc/tests/simplCore/should_run/simplrun001.stderr
@@ -0,0 +1,2 @@
+
+Fail: foo
diff --git a/ghc/tests/simplCore/should_run/simplrun001.stdout b/ghc/tests/simplCore/should_run/simplrun001.stdout
new file mode 100644
index 000000000000..573541ac9702
--- /dev/null
+++ b/ghc/tests/simplCore/should_run/simplrun001.stdout
@@ -0,0 +1 @@
+0
-- 
GitLab