Skip to content

Commit

Permalink
Re #7670: WIP: test case for #7248 (#7702)
Browse files Browse the repository at this point in the history
* Re #7670: WIP: test case for #7248

Two problems remaining:
- Warning output is not recorded in the golden value.
- The correct warning is not produced yet.

Current warning:

    Warning: No remote package servers have been specified. Usually you would have one specified in the config file.

* Re #7670: completed: test case for #7248

* Re #7670: update test output witnessing the fix of #7248

* Re #7670: use cmd 'get' instead of 'unpack'

* Re #7670: rename test subdir 'Unpack' to 'Get'

* Re #7670: use .invalid domain in test

Co-authored-by: Francesco Gazzetta <[email protected]>
  • Loading branch information
andreasabel and fgaz authored Oct 7, 2021
1 parent bb08616 commit 6bb79dc
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cabal-testsuite/PackageTests/Get/T7248/cabal.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- This config file contains a bogus repository by intention.

repository repo.invalid
url: http://repo.invalid/
5 changes: 5 additions & 0 deletions cabal-testsuite/PackageTests/Get/T7248/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# cabal get
Warning: <ROOT>/cabal.config: Unrecognized stanza on line 3
Warning: The package list for 'repo.invalid' does not exist. Run 'cabal update' to download it.
Error: cabal: There is no package named 'a-b-s-e-n-t'.
You may need to run 'cabal update' to get the latest list of available packages.
15 changes: 15 additions & 0 deletions cabal-testsuite/PackageTests/Get/T7248/cabal.test.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- 2021-10-06, issue #7248
--
-- Purpose of this test:
-- Make sure that ordinary user communication does not contain 'Show'ed internal structures.
--
-- This is a golden value test that reports the produced error message.
-- Needs to be checked manually whether it meets expectations.

import Test.Cabal.Prelude
main = cabalTest $
fails $
cabalG
[ "--config-file", "cabal.config" ]
"get"
[ "a-b-s-e-n-t" ]
10 changes: 9 additions & 1 deletion cabal-testsuite/src/Test/Cabal/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,15 @@ cabalGArgs global_args cmd args input = do
-- overwritable
when (cmd == "v1-freeze") requireHasSourceCopy
let extra_args
| cmd `elem` ["v1-update", "outdated", "user-config", "man", "v1-freeze", "check"]
| cmd `elem`
[ "v1-update"
, "outdated"
, "user-config"
, "man"
, "v1-freeze"
, "check"
, "get", "unpack"
]
= [ ]

-- new-build commands are affected by testCabalProjectFile
Expand Down

0 comments on commit 6bb79dc

Please sign in to comment.