diff --git a/cabal-testsuite/PackageTests/Get/T7248/cabal.config b/cabal-testsuite/PackageTests/Get/T7248/cabal.config new file mode 100644 index 00000000000..d8c242312f5 --- /dev/null +++ b/cabal-testsuite/PackageTests/Get/T7248/cabal.config @@ -0,0 +1,4 @@ +-- This config file contains a bogus repository by intention. + +repository repo.invalid + url: http://repo.invalid/ diff --git a/cabal-testsuite/PackageTests/Get/T7248/cabal.out b/cabal-testsuite/PackageTests/Get/T7248/cabal.out new file mode 100644 index 00000000000..585ec82a6e1 --- /dev/null +++ b/cabal-testsuite/PackageTests/Get/T7248/cabal.out @@ -0,0 +1,5 @@ +# cabal get +Warning: /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. diff --git a/cabal-testsuite/PackageTests/Get/T7248/cabal.test.hs b/cabal-testsuite/PackageTests/Get/T7248/cabal.test.hs new file mode 100644 index 00000000000..782742f7ff0 --- /dev/null +++ b/cabal-testsuite/PackageTests/Get/T7248/cabal.test.hs @@ -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" ] diff --git a/cabal-testsuite/src/Test/Cabal/Prelude.hs b/cabal-testsuite/src/Test/Cabal/Prelude.hs index 7a5245415ed..f2dc8d4562e 100644 --- a/cabal-testsuite/src/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/src/Test/Cabal/Prelude.hs @@ -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