From 2b197f8e5a6bf15700656090872810c78225effd Mon Sep 17 00:00:00 2001
From: Kristen Kozak <grayjay@wordroute.com>
Date: Sun, 4 Mar 2018 17:40:22 -0800
Subject: [PATCH] Update regression test for issue #4154 after the fix for
 issue #415.

This commit addresses the comments in PR #5183.
---
 .../T4154/install-time-with-constraint.out    |  2 --
 .../install-time-with-constraint.test.hs      | 22 +++++++++++--------
 .../T4154/repo/Cabal-99999/Cabal.cabal        |  7 ------
 3 files changed, 13 insertions(+), 18 deletions(-)
 delete mode 100644 cabal-testsuite/PackageTests/Regression/T4154/repo/Cabal-99999/Cabal.cabal

diff --git a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out
index de5fbf4bdd..c0d2311a93 100644
--- a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out
+++ b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out
@@ -1,5 +1,3 @@
-# cabal update
-Downloading the latest package list from test-local-repo
 # cabal new-build
 Resolving dependencies...
 Build profile: -w ghc-<GHCVER> -O1
diff --git a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs
index 59aad8b34e..47fcca9db3 100644
--- a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs
+++ b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.test.hs
@@ -2,16 +2,20 @@ import Test.Cabal.Prelude
 
 -- Test that unqualified command line constraints do not constrain setup
 -- dependencies. cabal should be able to install the local time-99999 by
--- building its setup script with the installed time, even though the installed
--- time doesn't fit the constraint.
-main = cabalTest $ withRepo "repo" $ do
+-- building its setup script with the installed Cabal, which depends on the
+-- installed time, even though the installed time doesn't fit the constraint.
+main = cabalTest $ do
+  -- TODO: Run this test on Windows once #5187 is resolved.
+  skipIf =<< isWindows
+
   cabal "new-build" ["time", "--constraint=time==99999", "--dry-run"]
 
   -- Temporarily disabled recording here because output is not stable
   recordMode DoNotRecord $ do
-      r <- fails $ cabal' "new-build" ["time", "--constraint=any.time==99999", "--constraint=setup.Cabal installed", "--dry-run"]
-      -- Constraining all uses of 'time' originally resulted in a cyclic dependency
-      -- between 'Cabal' and the new 'time':
-      -- assertOutputContains "cyclic dependencies; conflict set: time:setup.Cabal, time:setup.time" r
-      -- However, this doesn't work anymore, so instead we more directly look for:
-      assertOutputContains "time:setup.time~>time-99999 (conflict: time:setup.Cabal" r
+    -- Constraining all uses of 'time' fails because the installed 'time'
+    -- doesn't fit the constraint.
+    r <- fails $ cabal' "new-build" ["time", "--constraint=any.time==99999", "--dry-run"]
+    assertRegex "Expected cabal to reject the setup dependency on the installed time"
+                ("rejecting: time:setup.time-[0-9.]*/installed-[^[:space:]]* "
+                  ++ "\\(constraint from command line flag requires ==99999\\)")
+                r
diff --git a/cabal-testsuite/PackageTests/Regression/T4154/repo/Cabal-99999/Cabal.cabal b/cabal-testsuite/PackageTests/Regression/T4154/repo/Cabal-99999/Cabal.cabal
deleted file mode 100644
index 2742fc2fc5..0000000000
--- a/cabal-testsuite/PackageTests/Regression/T4154/repo/Cabal-99999/Cabal.cabal
+++ /dev/null
@@ -1,7 +0,0 @@
-name:            Cabal
-version:         99999
-cabal-version:   >=1.8
-build-type:      Simple
-
-library
-  build-depends: base, time
-- 
GitLab