From c1e624306858e1e474818804bc9a1df1a1799991 Mon Sep 17 00:00:00 2001 From: Louis Gesbert Date: Mon, 17 Jan 2022 11:09:29 +0100 Subject: [PATCH] Add some tests for package remove --- tests/reftests/dune.inc | 17 ++++++++++++++ tests/reftests/remove.test | 48 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 tests/reftests/remove.test diff --git a/tests/reftests/dune.inc b/tests/reftests/dune.inc index 7ea8def67e2..17e9d581dd5 100644 --- a/tests/reftests/dune.inc +++ b/tests/reftests/dune.inc @@ -390,6 +390,23 @@ %{targets} (run ./run.exe %{bin:opam} %{dep:pin.test} %{read-lines:testing-env})))) +(rule + (alias reftest-remove) + (action + (diff remove.test remove.out))) + +(alias + (name reftest) + (deps (alias reftest-remove))) + +(rule + (targets remove.out) + (deps root-N0REP0) + (action + (with-stdout-to + %{targets} + (run ./run.exe %{bin:opam} %{dep:remove.test} %{read-lines:testing-env})))) + (rule (alias reftest-show) (action diff --git a/tests/reftests/remove.test b/tests/reftests/remove.test new file mode 100644 index 00000000000..480a2665735 --- /dev/null +++ b/tests/reftests/remove.test @@ -0,0 +1,48 @@ +N0REP0 +### :::::: removal of partial dependencies (#4727) +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +depends: "a" | "b" +### opam switch create default --empty +### opam install a b c +The following actions will be performed: + - install b 1 + - install a 1 + - install c 1 +===== 3 to install ===== + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed a.1 +-> installed b.1 +-> installed c.1 +Done. +### opam remove a --show +The following actions would be performed: + - remove a 1 + - recompile c 1 [uses a] +===== 1 to recompile | 1 to remove ===== +### opam remove --auto --show +Nothing to do. +### opam remove a --auto --show +The following actions would be performed: + - remove c 1 [uses a] + - remove a 1 +===== 2 to remove ===== +### :::::: message on removal of an unavailable package (#4890) +### +opam-version: "2.0" +available: false +### +opam-version: "2.0" +depends: "z" +### opam remove z +[ERROR] z: unmet availability conditions: 'false' +# Return code 5 # +### opam remove w +[NOTE] w is not installed. + +Nothing to do.