git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re*: [PATCH 1/3] t4034: bulk verify builtin word regex sanity

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 18, 2011, 18:00 UTC
Message-ID
<7voc7eks6e.fsf_-_@alter.siamese.dyndns.org>
In-Reply-To
<20110111214811.GB29133@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 5 quoted lines
> 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.
Show 8 quoted lines
> 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
Previous: Jonathan NiederNext: Jonathan Nieder
Message 19 of 23 in “--word-regex sanity checking and such”
  1. 0/4 --word-regex sanity checking and suchThomas Rast, Dec 15, 2010
  2. 1/4 diff.c: pass struct diff_words into find_word_boundariesThomas Rast, Dec 15, 2010
  3. 2/4 diff.c: implement a sanity check for word regexesThomas Rast, Dec 15, 2010
  4. 3/4 userdiff: fix typo in ruby word regexThomas Rast, Dec 15, 2010
  5. 4/4 t4034: bulk verify builtin word regex sanityThomas Rast, Dec 15, 2010
  6. Thomas RastDec 15, 2010
  7. Scott JohnsonDec 15, 2010
  8. 0/4 --word-regex sanity checking and suchThomas Rast, Dec 18, 2010
  9. 1/4 diff.c: pass struct diff_words into find_word_boundariesThomas Rast, Dec 18, 2010
  10. 2/4 diff.c: implement a sanity check for word regexesThomas Rast, Dec 18, 2010
  11. Junio C HamanoDec 18, 2010
  12. Thomas RastDec 19, 2010
  13. 3/4 userdiff: fix typo in ruby and python word regexesThomas Rast, Dec 18, 2010
  14. Junio C HamanoDec 18, 2010
  15. Thomas RastDec 19, 2010
  16. 4/4 t4034: bulk verify builtin word regex sanityThomas Rast, Dec 18, 2010
  17. 0/3 Re: t4034: bulk verify builtin word regex sanityJonathan Nieder, Jan 11, 2011
  18. 1/3 t4034: bulk verify builtin word regex sanityJonathan Nieder, Jan 11, 2011
  19. Re*: [PATCH 1/3] t4034: bulk verify builtin word regex sanityJunio C Hamano, Jan 18, 2011
  20. 2/3 userdiff: simplify word-diff safeguardJonathan Nieder, Jan 11, 2011
  21. 3/3 t4034 (diff --word-diff): style suggestionsJonathan Nieder, Jan 11, 2011
  22. Thomas RastDec 18, 2010
  23. Junio C HamanoDec 18, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.