git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ping Yin <pkufranky@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Ping Yin <pkufranky@gmail.com>
Subject: [PATCH v3 6/6] --color-words: Add test t4030
Date: Sun,  4 May 2008 12:20:15 +0800	[thread overview]
Message-ID: <1209874815-14411-7-git-send-email-pkufranky@gmail.com> (raw)
In-Reply-To: <1209874815-14411-6-git-send-email-pkufranky@gmail.com>

Also add a script gen-expect.sh to generate the expected
diff output.

Signed-off-by: Ping Yin <pkufranky@gmail.com>
---
 t/t4030-diff-color-words.sh |   42 ++++++++++++++++++++++++++++++++++++++++++
 t/t4030/expect1             |    1 +
 t/t4030/expect10            |    1 +
 t/t4030/expect2             |    1 +
 t/t4030/expect3             |    1 +
 t/t4030/expect4             |    1 +
 t/t4030/expect5             |    1 +
 t/t4030/expect6             |    1 +
 t/t4030/expect7             |    1 +
 t/t4030/expect8             |    1 +
 t/t4030/expect9             |    1 +
 t/t4030/gen-expect.sh       |   35 +++++++++++++++++++++++++++++++++++
 12 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100755 t/t4030-diff-color-words.sh
 create mode 100644 t/t4030/expect1
 create mode 100644 t/t4030/expect10
 create mode 100644 t/t4030/expect2
 create mode 100644 t/t4030/expect3
 create mode 100644 t/t4030/expect4
 create mode 100644 t/t4030/expect5
 create mode 100644 t/t4030/expect6
 create mode 100644 t/t4030/expect7
 create mode 100644 t/t4030/expect8
 create mode 100644 t/t4030/expect9
 create mode 100644 t/t4030/gen-expect.sh

diff --git a/t/t4030-diff-color-words.sh b/t/t4030-diff-color-words.sh
new file mode 100755
index 0000000..e1c8e8e
--- /dev/null
+++ b/t/t4030-diff-color-words.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+test_description='diff --color-words'
+
+. ./test-lib.sh
+. ../diff-lib.sh
+
+dotest() {
+	test_expect_success "$1" "
+	echo '$1' >t &&
+	git diff --color-words | tail -1 >actual &&
+	cat actual &&
+	test_cmp ../t4030/$2 actual
+"	
+}
+
+test_expect_success 'setup for foo bar(_baz' '
+	git config diff.nonwordchars "_()" &&
+	echo "foo bar(_baz" > t &&
+	git add t  &&
+	git commit -m "add t"
+'
+
+dotest "foo bar(_" expect1
+dotest "foo bar(" expect2
+dotest "foo bar" expect3
+dotest "foo (_baz" expect4
+dotest "foo _baz" expect5
+dotest "foo baz" expect6
+dotest "bar(_baz" expect7
+
+test_expect_success 'setup for foo bar(_' '
+	echo "foo bar(_" > t &&
+	git add t  &&
+	git commit -m "add t"
+'
+
+dotest "foo bar(" expect8
+dotest "foo bar" expect9
+dotest "foo bar_baz" expect10
+
+test_done
diff --git a/t/t4030/expect1 b/t/t4030/expect1
new file mode 100644
index 0000000..fb75467
--- /dev/null
+++ b/t/t4030/expect1
@@ -0,0 +1 @@
+^[[mfoo ^[[mbar(^[[m_^[[m^[[31mbaz^[[m^[[32m^[[m
diff --git a/t/t4030/expect10 b/t/t4030/expect10
new file mode 100644
index 0000000..b36e5db
--- /dev/null
+++ b/t/t4030/expect10
@@ -0,0 +1 @@
+^[[mfoo ^[[mbar^[[m^[[31m(^[[m^[[32m_^[[m^[[31m_^[[m^[[31m^[[m^[[32mbaz^[[m
diff --git a/t/t4030/expect2 b/t/t4030/expect2
new file mode 100644
index 0000000..6a9ca69
--- /dev/null
+++ b/t/t4030/expect2
@@ -0,0 +1 @@
+^[[mfoo ^[[mbar(^[[m^[[31m_^[[m^[[32m^[[m^[[31mbaz^[[m
diff --git a/t/t4030/expect3 b/t/t4030/expect3
new file mode 100644
index 0000000..d7d9885
--- /dev/null
+++ b/t/t4030/expect3
@@ -0,0 +1 @@
+^[[mfoo ^[[mbar^[[m^[[31m(^[[m^[[32m^[[m^[[31m_^[[m^[[31mbaz^[[m
diff --git a/t/t4030/expect4 b/t/t4030/expect4
new file mode 100644
index 0000000..449fd6d
--- /dev/null
+++ b/t/t4030/expect4
@@ -0,0 +1 @@
+^[[mfoo ^[[m^[[31mbar(^[[m^[[32m(^[[m_^[[mbaz^[[m
diff --git a/t/t4030/expect5 b/t/t4030/expect5
new file mode 100644
index 0000000..eb184f7
--- /dev/null
+++ b/t/t4030/expect5
@@ -0,0 +1 @@
+^[[mfoo ^[[m^[[31mbar(^[[m_^[[mbaz^[[m
diff --git a/t/t4030/expect6 b/t/t4030/expect6
new file mode 100644
index 0000000..58591ad
--- /dev/null
+++ b/t/t4030/expect6
@@ -0,0 +1 @@
+^[[mfoo ^[[m^[[31mbar(^[[m^[[31m_^[[mbaz^[[m
diff --git a/t/t4030/expect7 b/t/t4030/expect7
new file mode 100644
index 0000000..c68a1f1
--- /dev/null
+++ b/t/t4030/expect7
@@ -0,0 +1 @@
+^[[m^[[31mfoo ^[[mbar(^[[m_^[[mbaz^[[m
diff --git a/t/t4030/expect8 b/t/t4030/expect8
new file mode 100644
index 0000000..f48152f
--- /dev/null
+++ b/t/t4030/expect8
@@ -0,0 +1 @@
+^[[mfoo ^[[mbar(^[[m^[[31m_^[[m^[[32m^[[m^[[31m^[[m
diff --git a/t/t4030/expect9 b/t/t4030/expect9
new file mode 100644
index 0000000..4f42b6c
--- /dev/null
+++ b/t/t4030/expect9
@@ -0,0 +1 @@
+^[[mfoo ^[[mbar^[[m^[[31m(^[[m^[[32m^[[m^[[31m_^[[m^[[31m^[[m
diff --git a/t/t4030/gen-expect.sh b/t/t4030/gen-expect.sh
new file mode 100644
index 0000000..da07535
--- /dev/null
+++ b/t/t4030/gen-expect.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+git config diff.nonwordchars "_()"
+
+echo "foo bar(_baz" >&2 &&
+echo "foo bar(_baz" > t
+
+git add t  &&
+git commit -m "add t"
+
+dotest() {
+	echo "$1" >&2 &&
+	echo "$1" >t  &&
+	git diff --color-words |
+	tail -1 > $2
+}
+
+dotest "foo bar(_" expect1
+dotest "foo bar(" expect2
+dotest "foo bar" expect3
+dotest "foo (_baz" expect4
+dotest "foo _baz" expect5
+dotest "foo baz" expect6
+dotest "bar(_baz" expect7
+
+
+echo "foo bar(_" >&2 &&
+echo "foo bar(_" >t
+
+git add t  &&
+git commit -m "add t"
+
+dotest "foo bar(" expect8
+dotest "foo bar" expect9
+dotest "foo bar_baz" expect10
-- 
1.5.5.1.121.g26b3

  reply	other threads:[~2008-05-04  4:21 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02  3:39 [PATCH] Make words boundary for --color-words configurable Ping Yin
2008-05-02  3:54 ` Junio C Hamano
2008-05-02  4:28   ` Ping Yin
2008-05-02 13:59     ` [PATCH] Make boundary characters " Ping Yin
2008-05-02 14:26       ` Ping Yin
2008-05-02 14:27         ` Ping Yin
2008-05-03 11:57         ` [PATCH v2 0/5] " Ping Yin
2008-05-03 11:57           ` [PATCH v2 1/5] diff.c: Remove code redundancy in diff_words_show Ping Yin
2008-05-03 11:57             ` [PATCH v2 2/5] diff.c: Use show variable name in fn_out_diff_words_aux Ping Yin
2008-05-03 11:57               ` [PATCH v2 3/5] diff.c: Fix --color-words showing trailing deleted words at another line Ping Yin
2008-05-03 11:57                 ` [PATCH v2 4/5] Make boundary characters for --color-words configurable Ping Yin
2008-05-03 11:57                   ` [PATCH v2 5/5] fn_out_diff_words_aux: Handle common diff line more carefully Ping Yin
2008-05-03 18:18                   ` [PATCH v2 4/5] Make boundary characters for --color-words configurable Junio C Hamano
2008-05-03 18:41                     ` Teemu Likonen
2008-05-04  0:32                     ` Ping Yin
2008-05-04  9:44                       ` Johannes Schindelin
2008-05-04 16:35                         ` Ping Yin
2008-05-04 20:16                           ` Junio C Hamano
2008-05-04 20:47                             ` Jakub Narebski
2008-05-04 21:27                               ` Teemu Likonen
2008-05-05 12:14                               ` Johannes Schindelin
2008-05-05  1:40                             ` Ping Yin
2008-05-05  5:00                               ` Junio C Hamano
2008-05-05 12:10                                 ` Ping Yin
2008-05-06  0:40                                   ` Ping Yin
2008-05-06  8:55                                     ` Johannes Schindelin
2008-05-07  1:15                                       ` Ping Yin
2008-05-07 11:24                                         ` Johannes Schindelin
2008-05-07 12:19                                           ` Ping Yin
2008-05-07 13:10                                             ` Johannes Schindelin
2008-05-07 14:11                                               ` Ping Yin
2008-05-07 19:13                                           ` Junio C Hamano
2008-05-07 19:33                                             ` Junio C Hamano
2008-05-07 19:45                                             ` Jeff King
2008-05-07 20:02                                               ` Junio C Hamano
2008-05-07 22:04                                                 ` Jeff King
2008-05-08 10:34                                             ` Teemu Likonen
2008-05-10  9:02                                               ` Ping Yin
2008-05-10  9:14                                                 ` Teemu Likonen
2008-05-11 13:16                                                 ` Ping Yin
2008-05-11 13:27                                                   ` Ping Yin
2008-05-11 16:27                                                   ` Junio C Hamano
2008-05-12 16:31                                                     ` Ping Yin
2008-05-12 18:57                                                       ` Jakub Narebski
2008-05-12 19:17                                                         ` Junio C Hamano
2008-05-12 19:57                                                           ` Jakub Narebski
2008-05-13  1:37                                                           ` Ping Yin
2008-05-13  1:42                                                         ` Ping Yin
2008-05-10  8:20                                             ` Ping Yin
2008-05-05 11:51                           ` Johannes Schindelin
2008-05-05 12:02                             ` Ping Yin
2008-05-03 18:01                 ` [PATCH v2 3/5] diff.c: Fix --color-words showing trailing deleted words at another line Junio C Hamano
2008-05-03 12:01               ` [PATCH v2 2/5] diff.c: Use show variable name in fn_out_diff_words_aux Ping Yin
2008-05-03 17:47               ` Junio C Hamano
2008-05-03 18:20             ` [PATCH v2 1/5] diff.c: Remove code redundancy in diff_words_show Junio C Hamano
2008-05-04  4:20           ` [PATCH v3 0/6] --color-words improvement Ping Yin
2008-05-04  4:20             ` [PATCH v3 1/6] diff.c: Remove code redundancy in diff_words_show Ping Yin
2008-05-04  4:20               ` [PATCH v3 2/6] fn_out_diff_words_aux: Use short variable name Ping Yin
2008-05-04  4:20                 ` [PATCH v3 3/6] --color-words: Fix showing trailing deleted words at another line Ping Yin
2008-05-04  4:20                   ` [PATCH v3 4/6] --color-words: Make non-word characters configurable Ping Yin
2008-05-04  4:20                     ` [PATCH v3 5/6] fn_out_diff_words_aux: Handle common diff line more carefully Ping Yin
2008-05-04  4:20                       ` Ping Yin [this message]
2008-05-04  9:54                       ` Johannes Schindelin
2008-05-04 16:53                         ` Ping Yin
2008-05-05 12:11                           ` Johannes Schindelin
2008-05-05 14:18                             ` Ping Yin
2008-05-04  6:45                     ` [PATCH v3 4/6] --color-words: Make non-word characters configurable Junio C Hamano
2008-05-04  7:04                       ` Ping Yin
2008-05-04  9:52                   ` [PATCH v3 3/6] --color-words: Fix showing trailing deleted words at another line Johannes Schindelin
2008-05-04 16:48                     ` Ping Yin
2008-05-05 12:10                       ` Johannes Schindelin
2008-05-04  9:47                 ` [PATCH v3 2/6] fn_out_diff_words_aux: Use short variable name Johannes Schindelin
2008-05-04 16:39                   ` Ping Yin
2008-05-05 12:05                     ` Johannes Schindelin
2008-05-04  9:46               ` [PATCH v3 1/6] diff.c: Remove code redundancy in diff_words_show Johannes Schindelin
2008-05-02 14:36       ` [PATCH] Make boundary characters for --color-words configurable Teemu Likonen
2008-05-03  0:22         ` Ping Yin
2008-05-03 13:22           ` Dirk Süsserott
2008-05-03 13:57             ` Ping Yin
2008-05-03 14:03       ` [PATCH] --color-words: Make the word characters configurable Johannes Schindelin
2008-05-03 14:13         ` Ping Yin
2008-05-03 14:23           ` Johannes Schindelin
2008-05-03 14:43         ` Teemu Likonen
2008-05-04  9:18           ` Johannes Schindelin
2008-05-03 17:43         ` Junio C Hamano
2008-05-04  9:25           ` Johannes Schindelin
2008-05-02  7:45 ` [PATCH] Make words boundary for --color-words configurable Johannes Schindelin
2008-05-02  8:14   ` Teemu Likonen
2008-05-02  9:23     ` Ping Yin
2008-05-02 10:01     ` Teemu Likonen
2008-05-02  9:28   ` Ping Yin
2008-05-03  0:18   ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1209874815-14411-7-git-send-email-pkufranky@gmail.com \
    --to=pkufranky@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).