[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-vc-dwim] [PATCH 2/3] New xfailing test: vc-chlog --stdin with dirty
From: |
Ralf Wildenhues |
Subject: |
[Bug-vc-dwim] [PATCH 2/3] New xfailing test: vc-chlog --stdin with dirty workdir. |
Date: |
Sat, 12 Mar 2011 12:37:45 +0100 |
User-agent: |
Mutt/1.5.20 (2010-08-04) |
* tests/dirty-workdir: New test.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
Signed-off-by: Ralf Wildenhues <address@hidden>
---
tests/Makefile.am | 6 +++-
tests/dirty-workdir | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 86 insertions(+), 1 deletions(-)
create mode 100644 tests/dirty-workdir
diff --git a/tests/Makefile.am b/tests/Makefile.am
index acac34e..a3fd83c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,10 @@ TESTS = \
subdir \
subdir-cvs \
t-vc-chlog \
- multiple-chlogs
+ multiple-chlogs \
+ dirty-workdir
+
+XFAIL_TESTS = \
+ dirty-workdir
include $(srcdir)/check.mk
diff --git a/tests/dirty-workdir b/tests/dirty-workdir
new file mode 100644
index 0000000..a9ef8fe
--- /dev/null
+++ b/tests/dirty-workdir
@@ -0,0 +1,81 @@
+#! /bin/sh
+# Test vc-chlog.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ vc-chlog --version
+fi
+
+. $srcdir/trap-setup
+require_git_
+
+mkdir -p $tmp && cd $tmp || {
+ echo "$0: failure in testing framework" 1>&2
+ (exit 1); exit 1
+}
+
+# Let's see whether this system knows unidiff format.
+# We assume that if diff doesn't, then patch also won't.
+# As long as vc-chlog only works with unidiff, SKIP the test.
+: ${diff=diff}
+: >empty
+if ($diff -u empty empty) >/dev/null 2>&1; then
+ diff_u="$diff -u"
+else
+ diff_u=$diff
+ skip_test_ "$diff -u does not work"
+ (exit 77); exit 77
+fi
+
+run_vc_chlog ()
+{
+ infile=$1
+ shift
+ { vc-chlog --stdin ${1+"$@"} < "$infile" 2>stderr ||
+ { echo; echo; echo vc-chlog failed; }; } |
+ sed 1,2d > stdout
+ test "$VERBOSE" != yes || { cat stdout; cat stderr >&2; }
+}
+
+fail=0
+set -e
+
+### Set up files ###
+
+git init
+cat >file.c <<\EOF
+int foo ()
+{
+ return 0;
+}
+EOF
+git add file.c
+git commit -m init
+# Simulate add -i by two edits and an add in between.
+cat >file.c <<\EOF
+int foo ()
+{
+ return 42;
+}
+EOF
+git add file.c
+cat >file.c <<\EOF
+int bar (int x)
+{
+ return 2 * x;
+}
+
+int foo ()
+{
+ int x;
+ return 42;
+}
+EOF
+# This will now mention the 'bar' function, although that is not
+# present in the commit at all.
+git diff --cached > diff
+run_vc_chlog diff
+grep '(foo)' stdout
+
+Exit 0
+
--
1.7.4.1.227.gadfe4
- [Bug-vc-dwim] [PATCH 0/3] let vc-chlog cope better with git add -i, Ralf Wildenhues, 2011/03/12
- [Bug-vc-dwim] [PATCH 1/3] vc-chlog: refactor tag list creation, for next change., Ralf Wildenhues, 2011/03/12
- [Bug-vc-dwim] [PATCH 2/3] New xfailing test: vc-chlog --stdin with dirty workdir.,
Ralf Wildenhues <=
- [Bug-vc-dwim] [PATCH 3a/3] vc-chlog: new option --dirty-workdir for git add --interactive., Ralf Wildenhues, 2011/03/12
- [Bug-vc-dwim] [PATCH 3b/3] vc-chlog --stdin: try to cope with dirty workdir., Ralf Wildenhues, 2011/03/12
- Re: [Bug-vc-dwim] [PATCH 0/3] let vc-chlog cope better with git add -i, Jim Meyering, 2011/03/16