[PATCH v10 02/15] contrib: related: add tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 contrib/related/Makefile       | 17 +++++++++++++
 contrib/related/test-related.t | 54 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 contrib/related/Makefile
 create mode 100755 contrib/related/test-related.t

diff --git a/contrib/related/Makefile b/contrib/related/Makefile
new file mode 100644
index 0000000..1224fce
--- /dev/null
+++ b/contrib/related/Makefile
@@ -0,0 +1,17 @@
+TESTS := $(wildcard test-*.t)
+
+export T := $(addprefix $(CURDIR)/,$(TESTS))
+export MAKE := $(MAKE) -e
+export PATH := $(CURDIR):$(PATH)
+export TEST_LINT := test-lint-executable test-lint-shell-syntax
+export TEST_DIRECTORY := $(CURDIR)/../../t
+
+all:
+
+test:
+	$(MAKE) -C ../../t $@
+
+$(TESTS): all
+	$(MAKE) -C ../../t $(CURDIR)/$@
+
+.PHONY: all test $(TESTS)
diff --git a/contrib/related/test-related.t b/contrib/related/test-related.t
new file mode 100755
index 0000000..b69684d
--- /dev/null
+++ b/contrib/related/test-related.t
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+test_description="Test git related"
+
+test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$PWD/../../t"
+. "$TEST_DIRECTORY"/test-lib.sh
+
+setup() {
+	git init &&
+	echo one > content &&
+	git add content &&
+	git commit -q -m one --author='Pablo Escobar <pablo@xxxxxxxxxxx>' &&
+	echo two >> content &&
+	git commit -q -a -m one --author='Jon Stewart <jon@xxxxxxxxxxx>' &&
+	echo three >> content &&
+	git commit -q -a -m three --author='John Doe <john@xxxxxxx>' &&
+	echo four >> content &&
+	git branch basic &&
+	git commit -q -a -F - --author='John Poppins <john@xxxxxxx>' <<-EOF &&
+	four
+
+	Reviewed-by: Jon Stewart <jon@xxxxxxxxxxx>
+	EOF
+	echo five >> content &&
+	git commit -q -a -m five --author='Mary Poppins <mary@xxxxxxxxxxxx>'
+	git checkout -b next &&
+	echo six >> content &&
+	git commit -q -a -m six --author='Ocatio Paz <octavio.paz@xxxxxxxxx>'
+}
+
+setup
+
+test_expect_success "basic" "
+	git format-patch --stdout -1 basic > patch &&
+	git related patch | sort > actual &&
+	cat > expected <<-EOF &&
+	Jon Stewart <jon@xxxxxxxxxxx>
+	Pablo Escobar <pablo@xxxxxxxxxxx>
+	EOF
+	test_cmp expected actual
+"
+
+test_expect_success "others" "
+	git format-patch --stdout -1 master > patch &&
+	git related patch | sort > actual &&
+	cat > expected <<-EOF &&
+	John Doe <john@xxxxxxx>
+	John Poppins <john@xxxxxxx>
+	Jon Stewart <jon@xxxxxxxxxxx>
+	EOF
+	test_cmp expected actual
+"
+
+test_done
-- 
1.8.4-fc

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]