git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Thomas Rast <trast@student.ethz.ch>,
	Scott Johnson <scottj75074@yahoo.com>,
	Michael J Gruber <git@drmicha.warpmail.net>,
	Matthijs Kooijman <matthijs@stdin.nl>,
	git@vger.kernel.org
Subject: Re*: [PATCH 1/3] t4034: bulk verify builtin word regex sanity
Date: Tue, 18 Jan 2011 10:00:57 -0800	[thread overview]
Message-ID: <7voc7eks6e.fsf_-_@alter.siamese.dyndns.org> (raw)
In-Reply-To: <20110111214811.GB29133@burratino> (Jonathan Nieder's message of "Tue\, 11 Jan 2011 15\:48\:11 -0600")

Jonathan Nieder <jrnieder@gmail.com> writes:

> From: Thomas Rast <trast@student.ethz.ch>
> Date: Sat, 18 Dec 2010 17:17:54 +0100
>
> The builtin word regexes should be tested with some simple examples
> against simple issues.  Do this in bulk.

Thanks.

> diff --git a/t/t4034/bibtex/expect b/t/t4034/bibtex/expect
> new file mode 100644
> index 0000000..a157774
> --- /dev/null
> +++ b/t/t4034/bibtex/expect
> @@ -0,0 +1,15 @@
> +<BOLD>diff --git a/pre b/post<RESET>
> +<BOLD>index 95cd55b..ddcba9b 100644<RESET>

Having to change this line every time the test input (or output) has
changed is somewhat unfortunate.

Also I noticed that "word_diff" shell function has this:

       test_must_fail git diff --no-index "$@" pre post >output &&

which solicits two comments:

 - We do not seem to document that --no-index implies --exit-code, ever
   since the latter option was introduced at 41bbf9d (Allow git-diff exit
   with codes similar to diff(1), 2007-03-14).  Probably we should.

 - This assumes that no test vector would have identical pre/post pair
   that expects no output, which feels somewhat limiting.

What we care about in this test is that "git diff --no-index" does not die
an uncontrolled death, so test_might_fail may be more appropriate.

Here is another that probably should be squashed to this patch together
with 3/3 to add tests for the perl driver (I noticed it only because 2/3
had trivial conflict due to recent addition of it).

-- >8 --
From: Junio C Hamano <gitster@pobox.com>
Date: Tue, 18 Jan 2011 09:43:43 -0800
Subject: [PATCH] t4034 (diff --word-diff): add a minimum Perl drier test vector

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t4034-diff-words.sh |    1 +
 t/t4034/perl/expect   |   13 +++++++++++++
 t/t4034/perl/post     |   22 ++++++++++++++++++++++
 t/t4034/perl/pre      |   22 ++++++++++++++++++++++
 4 files changed, 58 insertions(+), 0 deletions(-)
 create mode 100644 t/t4034/perl/expect
 create mode 100644 t/t4034/perl/post
 create mode 100644 t/t4034/perl/pre

diff --git a/t/t4034-diff-words.sh b/t/t4034-diff-words.sh
index c3b1c48..37aeab0 100755
--- a/t/t4034-diff-words.sh
+++ b/t/t4034-diff-words.sh
@@ -301,6 +301,7 @@ test_language_driver html
 test_language_driver java
 test_language_driver objc
 test_language_driver pascal
+test_language_driver perl
 test_language_driver php
 test_language_driver python
 test_language_driver ruby
diff --git a/t/t4034/perl/expect b/t/t4034/perl/expect
new file mode 100644
index 0000000..a1deb6b
--- /dev/null
+++ b/t/t4034/perl/expect
@@ -0,0 +1,13 @@
+<BOLD>diff --git a/pre b/post<RESET>
+<BOLD>index f6610d3..e8b72ef 100644<RESET>
+<BOLD>--- a/pre<RESET>
+<BOLD>+++ b/post<RESET>
+<CYAN>@@ -4,8 +4,8 @@<RESET>
+
+package Frotz;<RESET>
+sub new {<RESET>
+	my <GREEN>(<RESET>$class<GREEN>, %opts)<RESET> = <RED>shift<RESET><GREEN>@_<RESET>;
+	return bless { <GREEN>xyzzy => "nitfol", %opts<RESET> }, $class;
+}<RESET>
+
+__END__<RESET>
diff --git a/t/t4034/perl/post b/t/t4034/perl/post
new file mode 100644
index 0000000..e8b72ef
--- /dev/null
+++ b/t/t4034/perl/post
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use strict;
+
+package Frotz;
+sub new {
+	my ($class, %opts) = @_;
+	return bless { xyzzy => "nitfol", %opts }, $class;
+}
+
+__END__
+=head1 NAME
+
+frotz - Frotz
+
+=head1 SYNOPSIS
+
+  use frotz;
+
+  $nitfol = new Frotz();
+
+=cut
diff --git a/t/t4034/perl/pre b/t/t4034/perl/pre
new file mode 100644
index 0000000..f6610d3
--- /dev/null
+++ b/t/t4034/perl/pre
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+
+use strict;
+
+package Frotz;
+sub new {
+	my $class = shift;
+	return bless {}, $class;
+}
+
+__END__
+=head1 NAME
+
+frotz - Frotz
+
+=head1 SYNOPSIS
+
+  use frotz;
+
+  $nitfol = new Frotz();
+
+=cut
-- 
1.7.4.rc2.226.g63d9a

  reply	other threads:[~2011-01-18 18:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15  3:47 html userdiff is not showing all my changes Scott Johnson
2010-12-15  9:06 ` Michael J Gruber
2010-12-15  9:12   ` Matthijs Kooijman
2010-12-15  9:29     ` Michael J Gruber
2010-12-15 15:13 ` [PATCH 0/4] --word-regex sanity checking and such Thomas Rast
2010-12-15 15:13   ` [PATCH 1/4] diff.c: pass struct diff_words into find_word_boundaries Thomas Rast
2010-12-15 15:13   ` [PATCH 2/4] diff.c: implement a sanity check for word regexes Thomas Rast
2010-12-15 15:13   ` [PATCH 3/4] userdiff: fix typo in ruby word regex Thomas Rast
2010-12-15 15:13   ` [PATCH 4/4] t4034: bulk verify builtin word regex sanity Thomas Rast
     [not found]   ` <913156.57703.qm@web110711.mail.gq1.yahoo.com>
2010-12-15 19:51     ` [PATCH 0/4] --word-regex sanity checking and such Thomas Rast
2010-12-15 20:48       ` Scott Johnson
2010-12-18 16:17         ` [PATCH v2 " Thomas Rast
2010-12-18 16:17           ` [PATCH v2 1/4] diff.c: pass struct diff_words into find_word_boundaries Thomas Rast
2010-12-18 16:17           ` [PATCH v2 2/4] diff.c: implement a sanity check for word regexes Thomas Rast
2010-12-18 21:00             ` Junio C Hamano
2010-12-19  1:59               ` Thomas Rast
2010-12-18 16:17           ` [PATCH v2 3/4] userdiff: fix typo in ruby and python " Thomas Rast
2010-12-18 21:02             ` Junio C Hamano
2010-12-19  2:10               ` Thomas Rast
2010-12-18 16:17           ` [PATCH v2 4/4] t4034: bulk verify builtin word regex sanity Thomas Rast
2011-01-11 21:47             ` [RFC/PATCH 0/3] " Jonathan Nieder
2011-01-11 21:48               ` [PATCH 1/3] " Jonathan Nieder
2011-01-18 18:00                 ` Junio C Hamano [this message]
2011-01-11 21:48               ` [PATCH 2/3] userdiff: simplify word-diff safeguard Jonathan Nieder
2011-01-11 21:49               ` [PATCH 3/3] t4034 (diff --word-diff): style suggestions Jonathan Nieder
2010-12-18 16:24           ` [PATCH v2 0/4] --word-regex sanity checking and such Thomas Rast
2010-12-18 20:48             ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7voc7eks6e.fsf_-_@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=matthijs@stdin.nl \
    --cc=scottj75074@yahoo.com \
    --cc=trast@student.ethz.ch \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).