From 468bb1781b440af03ce90bffc3454c000ab8f248 Mon Sep 17 00:00:00 2001 From: Sun Podder Date: Tue, 28 Jan 2025 19:20:28 +0600 Subject: [PATCH] test: add integration test for remove command --- tests/07-remove.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/07-remove.sh diff --git a/tests/07-remove.sh b/tests/07-remove.sh new file mode 100644 index 000000000..9ee185b9f --- /dev/null +++ b/tests/07-remove.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +test_description='Test the remove command' + +WHEREAMI=$(dirname "$(realpath "$0")") +. $WHEREAMI/setup.sh + +test_expect_success 'cabin remove tbb mydep toml11' ' + test_when_finished "rm -rf remove_test" && + "$CABIN_BIN" new remove_test && + cd remove_test && + echo "[dependencies]" >> cabin.toml && + echo "tbb = {}" >> cabin.toml && + echo "toml11 = {}" >> cabin.toml && + ( + "$CABIN_BIN" remove tbb mydep toml11 >actual 2>&1 && + ! grep -q "tbb" cabin.toml && + ! grep -q "toml11" cabin.toml + ) && + cat >expected <<-EOF && +Warning: Dependency \`mydep\` not found in $WHEREAMI/trash directory.07-remove.sh/remove_test/cabin.toml + Removed tbb, toml11 from $WHEREAMI/trash directory.07-remove.sh/remove_test/cabin.toml +EOF + test_cmp expected actual +' +test_done