threads / patch / 13172

patchAdd tests for `branch --[no-]merged`

Subject: [PATCH 3/1] Add tests for `branch --[no-]merged`

## tl;dr

One message between Apr 18, 2008 and Apr 18, 2008. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Lars Hjemli· Apr 18, 2008, 16:30 UTC · lore
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---

A bit late, but here's a testscript for the new options (shamelessly based on t3201).

 t/t3202-branch-merged.sh |   68 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)
 create mode 100755 t/t3202-branch-merged.sh
Show changes to t/t3202-branch-merged.sh +68 −0
diff --git a/t/t3202-branch-merged.sh b/t/t3202-branch-merged.sh
new file mode 100755
index 0000000..2710923
--- /dev/null
+++ b/t/t3202-branch-merged.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+test_description='branch --merged/--no-merged'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+
+	>file &&
+	git add file &&
+	test_tick &&
+	git commit -m initial &&
+	git branch side &&
+
+	echo 1 >file &&
+	test_tick &&
+	git commit -a -m "second on master" &&
+
+	git checkout side &&
+	echo 1 >file &&
+	test_tick &&
+	git commit -a -m "second on side" &&
+
+	git merge master
+
+'
+
+test_expect_success 'side: branch --merged' '
+
+	git branch --merged >actual &&
+	{
+		echo "  master" &&
+		echo "* side"
+	} >expect &&
+	test_cmp expect actual
+
+'
+
+test_expect_success 'side: branch --no-merged' '
+
+	git branch --no-merged >actual &&
+	>expect &&
+	test_cmp expect actual
+
+'
+
+test_expect_success 'master: branch --merged' '
+
+	git checkout master &&
+	git branch --merged >actual &&
+	{
+		echo "* master"
+	} >expect &&
+	test_cmp expect actual
+
+'
+
+test_expect_success 'master: branch --no-merged' '
+
+	git branch --no-merged >actual &&
+	{
+		echo "  side"
+	} >expect &&
+	test_cmp expect actual
+
+'
+
+test_done
-- 
1.5.5.74.g74a72

← back to recent threads