Commit ea879c3e authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Port sandbox-sources to cabal-testsuite (except delete non-existent test.)


Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent 6b90d875
......@@ -56,15 +56,6 @@ Extra-Source-Files:
tests/IntegrationTests/sandbox-reinstalls/q/Q.hs
tests/IntegrationTests/sandbox-reinstalls/q/q.cabal
tests/IntegrationTests/sandbox-reinstalls/reinstall-modified-source.sh
tests/IntegrationTests/sandbox-sources/fail_removing_source_thats_not_registered.err
tests/IntegrationTests/sandbox-sources/fail_removing_source_thats_not_registered.sh
tests/IntegrationTests/sandbox-sources/p/Setup.hs
tests/IntegrationTests/sandbox-sources/p/p.cabal
tests/IntegrationTests/sandbox-sources/q/Setup.hs
tests/IntegrationTests/sandbox-sources/q/q.cabal
tests/IntegrationTests/sandbox-sources/remove_nonexistent_source.sh
tests/IntegrationTests/sandbox-sources/report_success_removing_source.out
tests/IntegrationTests/sandbox-sources/report_success_removing_source.sh
tests/IntegrationTests2/build/keep-going/cabal.project
tests/IntegrationTests2/build/keep-going/p/P.hs
tests/IntegrationTests2/build/keep-going/p/p.cabal
......
Warning: Sources not registered: "q"
RE:^cabal(\.exe)?: The sources with the above errors were skipped\. \("q"\)$
. ./common.sh
# Create the sandbox
cabal sandbox init > /dev/null
# Add one source
cabal sandbox add-source p > /dev/null
# Remove a source that exists on disk, but is not registered
! cabal sandbox delete-source q
. ./common.sh
# Create the sandbox
cabal sandbox init
# Add the sources
cabal sandbox add-source p
cabal sandbox add-source q
# delete the directory on disk
rm -R p
# Remove the registered source which is no longer on disk. cabal's handling of
# non-existent sources depends on the behavior of the directory package.
if OUTPUT=`cabal sandbox delete-source p 2>&1`; then
# 'canonicalizePath' should always succeed with directory >= 1.2.3.0
echo $OUTPUT | grep 'Success deleting sources: "p"' \
|| die "Incorrect success message: $OUTPUT"
else
echo $OUTPUT | grep 'Warning: Source directory not found for paths: "p"' \
|| die "Incorrect failure message: $OUTPUT"
fi
Success deleting sources: "p" "q"
Note: 'sandbox delete-source' only unregisters the source dependency, but does
not remove the package from the sandbox package DB.
Use 'sandbox hc-pkg -- unregister' to do that.
. ./common.sh
# Create the sandbox
cabal sandbox init > /dev/null
# Add the sources
cabal sandbox add-source p > /dev/null
cabal sandbox add-source q > /dev/null
# Remove one of the sources
cabal sandbox delete-source p q
# cabal sandbox init
Writing a default package environment file to <ROOT>/sandbox.dist/cabal.sandbox.config
Creating a new sandbox at <ROOT>/sandbox.dist/sandbox
# cabal sandbox add-source
# cabal sandbox delete-source
Warning: Sources not registered: "q"
cabal: The sources with the above errors were skipped. ("q")
# cabal sandbox add-source
# cabal sandbox delete-source
Success deleting sources: "p" "q"
Note: 'sandbox delete-source' only unregisters the source dependency, but does not remove the package from the sandbox package DB.
Use 'sandbox hc-pkg -- unregister' to do that.
import Test.Cabal.Prelude
main = cabalTest $ do
withSandbox $ do
cabal_sandbox "add-source" ["p"]
fails $ cabal_sandbox "delete-source" ["q"]
cabal_sandbox "add-source" ["q"]
cabal_sandbox "delete-source" ["p", "q"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment