-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4127 from qrilka/config-yaml-for-allow-newer
Point to user's config.yaml when advising 'allow-newer: true'
- Loading branch information
Showing
5 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
test/integration/tests/3685-config-yaml-for-allow-newer/Main.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Control.Monad (unless) | ||
import Data.List (isInfixOf) | ||
import StackTest | ||
import System.Directory | ||
|
||
main :: IO () | ||
main = do | ||
stack ["init", defaultResolverArg] | ||
(_, stdErr) <- stackStderr ["install", "intero-0.1.23"] | ||
-- here we check stderr for 'allow-newer: true' and | ||
-- config.yaml sitting either on the same line or on | ||
-- two consecutive lines | ||
let errLines = lines stdErr | ||
hasNewer l = "'allow-newer: true'" `isInfixOf` l | ||
withNewer = map hasNewer errLines | ||
userConfig = "config.yaml" | ||
hasConfigForAllowNewer prevNewer l = | ||
(prevNewer || hasNewer l) && | ||
userConfig `isInfixOf` l | ||
hasProperLines = | ||
or $ zipWith hasConfigForAllowNewer (False:withNewer) errLines | ||
unless hasProperLines $ | ||
error $ "Not stderr lines with 'allow-newer: true' and " ++ userConfig |
10 changes: 10 additions & 0 deletions
10
test/integration/tests/3685-config-yaml-for-allow-newer/files/files.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name: files | ||
version: 0.1.0.0 | ||
build-type: Simple | ||
cabal-version: >= 2.0 | ||
|
||
library | ||
exposed-modules: Src | ||
hs-source-dirs: src | ||
build-depends: base | ||
default-language: Haskell2010 |
5 changes: 5 additions & 0 deletions
5
test/integration/tests/3685-config-yaml-for-allow-newer/files/src/Src.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Src where | ||
|
||
-- | A function of the main library | ||
funMainLib :: Int -> Int | ||
funMainLib = succ |