-
Notifications
You must be signed in to change notification settings - Fork 722
Fix two issues when starting the repl #11237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mpickering
wants to merge
1
commit into
master
Choose a base branch
from
wip/11107
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+511
−38
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
module File where |
This file contains hidden or 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,8 @@ | ||
# cabal clean | ||
# cabal v2-repl | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- fake-package-0 (interactive) (lib) (first run) | ||
Configuring library for fake-package-0... | ||
Warning: No exposed modules |
This file contains hidden or 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,8 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = do | ||
cabalTest $ do | ||
cabal' "clean" [] | ||
res <- cabalWithStdin "v2-repl" ["-b", "containers"] ":m +Data.Map\n:t fromList" | ||
assertOutputContains "fromList :: Ord k => [(k, a)] -> Map k a" res | ||
|
This file contains hidden or 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 @@ | ||
packages: alt |
This file contains hidden or 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,4 @@ | ||
module ModuleA where | ||
|
||
a :: Int | ||
a = 42 |
This file contains hidden or 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,4 @@ | ||
module ModuleC where | ||
|
||
c :: Int | ||
c = 42 |
This file contains hidden or 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: alt | ||
version: 0.1 | ||
build-type: Simple | ||
cabal-version: >= 1.10 | ||
|
||
library | ||
exposed-modules: ModuleA, ModuleC | ||
build-depends: base | ||
default-language: Haskell2010 | ||
|
5 changes: 5 additions & 0 deletions
5
cabal-testsuite/PackageTests/ReplOptions/cabal.alt-multiple-repl-options.out
This file contains hidden or 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 @@ | ||
# cabal clean | ||
# cabal v2-repl | ||
Error: [Cabal-7076] | ||
Please pick a single [package:][ctype:]component (or all) as target for the REPL command. The packages in 'alt.project' from which to select a component target are: | ||
- alt |
5 changes: 5 additions & 0 deletions
5
cabal-testsuite/PackageTests/ReplOptions/cabal.alt-single-repl-options.out
This file contains hidden or 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 @@ | ||
# cabal clean | ||
# cabal v2-repl | ||
Error: [Cabal-7076] | ||
Please pick a single [package:][ctype:]component (or all) as target for the REPL command. The packages in 'alt.project' from which to select a component target are: | ||
- alt |
This file contains hidden or 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
18 changes: 18 additions & 0 deletions
18
cabal-testsuite/PackageTests/ReplProjectNoneTarget/cabal.out
This file contains hidden or 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,18 @@ | ||
# checking repl command with no project and --ignore-project | ||
# cabal repl | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- fake-package-0 (interactive) (lib) (first run) | ||
Configuring library for fake-package-0... | ||
Warning: No exposed modules | ||
# checking repl command with no project and no project options | ||
# cabal repl | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- fake-package-0 (interactive) (lib) (configuration changed) | ||
Configuring library for fake-package-0... | ||
Warning: No exposed modules | ||
# checking repl command with a missing project | ||
# cabal repl |
22 changes: 22 additions & 0 deletions
22
cabal-testsuite/PackageTests/ReplProjectNoneTarget/cabal.test.hs
This file contains hidden or 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,22 @@ | ||
import Test.Cabal.Prelude | ||
|
||
main = cabalTest . recordMode RecordMarked $ do | ||
let log = recordHeader . pure | ||
|
||
-- The following output is not what we want but is the current behaviour that | ||
-- refers to the fake package. | ||
log "checking repl command with no project and --ignore-project" | ||
ignored <- cabalWithStdin "repl" ["--ignore-project"] "" | ||
assertOutputContains "fake-package-0 (interactive) (lib) (first run)" ignored | ||
|
||
-- The following output is not what we want but is the current behaviour that | ||
-- refers to the fake package. | ||
log "checking repl command with no project and no project options" | ||
noOptions <- cabalWithStdin "repl" [] "" | ||
assertOutputContains "fake-package-0 (interactive) (lib) (configuration changed)" noOptions | ||
|
||
log "checking repl command with a missing project" | ||
missing <- fails $ cabalWithStdin "repl" [ "--project-file=missing.project" ] "" | ||
assertOutputContains "The given project file 'missing.project' does not exist." missing | ||
|
||
return () |
9 changes: 9 additions & 0 deletions
9
cabal-testsuite/PackageTests/ReplProjectNoneTarget/pkg-one/pkg-one.cabal
This file contains hidden or 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,9 @@ | ||
name: pkg-one | ||
version: 0.1 | ||
license: BSD3 | ||
cabal-version: >= 1.2 | ||
build-type: Simple | ||
|
||
library | ||
exposed-modules: Foo | ||
build-depends: base |
9 changes: 9 additions & 0 deletions
9
cabal-testsuite/PackageTests/ReplProjectNoneTarget/pkg-two/pkg-one.cabal
This file contains hidden or 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,9 @@ | ||
name: pkg-one | ||
version: 0.1 | ||
license: BSD3 | ||
cabal-version: >= 1.2 | ||
build-type: Simple | ||
|
||
library | ||
exposed-modules: Foo | ||
build-depends: base |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.