bug-vc-dwim
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]