unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test: Fix HTML rendering test
@ 2012-10-24 20:06 Austin Clements
  2012-10-25  1:59 ` Ethan Glasser-Camp
  0 siblings, 1 reply; 5+ messages in thread
From: Austin Clements @ 2012-10-24 20:06 UTC (permalink / raw)
  To: notmuch

The test designed to exercise Emacs' rendering of HTML emails
containing images inadvertently assumed w3m was available under Emacs
23.  The real point of this test was to exercise Emacs 24's shr
renderer, so if shr isn't available, we now fall back to html2text,
which comes with Emacs.
---
 test/emacs |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/emacs b/test/emacs
index 1f84b91..2ef78bf 100755
--- a/test/emacs
+++ b/test/emacs
@@ -756,7 +756,7 @@ add_message '[subject]="HTML mail with images"' \
     '[body]="--abcd
 Content-Type: text/html
 
-<img src="cid:330@goomoji.gmail">
+<img src="cid:330@goomoji.gmail"> smiley
 
 --abcd
 Content-Type: image/gif
@@ -766,10 +766,13 @@ Content-ID: <330@goomoji.gmail>
 R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMl
 WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7
 --abcd--"'
-test_emacs "(notmuch-show \"id:${gen_msg_id}\")
+test_emacs "(let ((mm-text-html-renderer
+		   (if (assq 'shr mm-text-html-renderer-alist)
+		       'shr 'html2text)))
+	      (notmuch-show \"id:${gen_msg_id}\"))
 	    (test-output)"
 # Normalize output for Emacs 23 and Emacs 24
-sed -i 's/\[cid\]/*/' OUTPUT
+sed -i 's/^ smiley/* smiley/' OUTPUT
 cat <<EOF >EXPECTED
 Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
 Subject: HTML mail with images
@@ -778,7 +781,7 @@ Date: Fri, 05 Jan 2001 15:43:57 +0000
 
 [ multipart/related ]
 [ text/html ]
-*
+* smiley
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] test: Fix HTML rendering test
  2012-10-24 20:06 [PATCH] test: Fix HTML rendering test Austin Clements
@ 2012-10-25  1:59 ` Ethan Glasser-Camp
  2012-10-25  2:11   ` Austin Clements
  0 siblings, 1 reply; 5+ messages in thread
From: Ethan Glasser-Camp @ 2012-10-25  1:59 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> The test designed to exercise Emacs' rendering of HTML emails
> containing images inadvertently assumed w3m was available under Emacs
> 23.  The real point of this test was to exercise Emacs 24's shr
> renderer, so if shr isn't available, we now fall back to html2text,
> which comes with Emacs.

Hi! I'm eager to apply any patch here that makes this better. But this
one doesn't fix it for me (24.1.1, although it seems to work with
23.4.1). OUTPUT is "*\nsmiley " (no space after the asterisk or before
the word smiley, but after). I see that this sed command is supposed to
normalize things, but at least on my setup, it doesn't. I also see "nil"
written to console, but I have no idea what that's about.

More generally, I guess I don't understand exactly what this test is
supposed to be exercising. The commit message says "the shr renderer",
but what about it? In
id:"1348941314-8377-4-git-send-email-amdragon@mit.edu" you write that
using shr raised a void-variable error previously, so maybe we're making
sure that error doesn't show up? In that case, even my semi-broken
output is good enough.

In a perfect world, test probably shouldn't succeed if shr isn't
present, but should note that it wasn't run. Maybe the emacs lisp code
can check for shr, and if it's not present, write "shr not present" to
an output file, and the shell code can grep for that and then call
test_skip if it sees it?

Still, I'm excited that you're working on this so please let's get it
fixed!

Ethan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] test: Fix HTML rendering test
  2012-10-25  1:59 ` Ethan Glasser-Camp
@ 2012-10-25  2:11   ` Austin Clements
  2012-10-25  8:06     ` Tomi Ollila
  2012-10-25 13:28     ` Ethan Glasser-Camp
  0 siblings, 2 replies; 5+ messages in thread
From: Austin Clements @ 2012-10-25  2:11 UTC (permalink / raw)
  To: Ethan Glasser-Camp; +Cc: notmuch

Quoth Ethan Glasser-Camp on Oct 24 at  9:59 pm:
> Austin Clements <amdragon@MIT.EDU> writes:
> 
> > The test designed to exercise Emacs' rendering of HTML emails
> > containing images inadvertently assumed w3m was available under Emacs
> > 23.  The real point of this test was to exercise Emacs 24's shr
> > renderer, so if shr isn't available, we now fall back to html2text,
> > which comes with Emacs.
> 
> Hi! I'm eager to apply any patch here that makes this better. But this
> one doesn't fix it for me (24.1.1, although it seems to work with
> 23.4.1). OUTPUT is "*\nsmiley " (no space after the asterisk or before
> the word smiley, but after). I see that this sed command is supposed to
> normalize things, but at least on my setup, it doesn't. I also see "nil"
> written to console, but I have no idea what that's about.

Emacs seems to have as many ways to convert HTML to text as there are
people trying to run this test.  What's the value of
mm-text-html-renderer for you in Emacs 24?

> More generally, I guess I don't understand exactly what this test is
> supposed to be exercising. The commit message says "the shr renderer",
> but what about it? In
> id:"1348941314-8377-4-git-send-email-amdragon@mit.edu" you write that
> using shr raised a void-variable error previously, so maybe we're making
> sure that error doesn't show up? In that case, even my semi-broken
> output is good enough.

Yes; this is essentially a regression test.  I would prefer not to
catch exceptions in this test because I think we'll eventually start
eating exceptions in body renderers to prevent them from breaking the
rest of the show buffer.  We could check that the output contains the
word "smiley" somewhere as evidence that it probably didn't crash.

> In a perfect world, test probably shouldn't succeed if shr isn't
> present, but should note that it wasn't run. Maybe the emacs lisp code
> can check for shr, and if it's not present, write "shr not present" to
> an output file, and the shell code can grep for that and then call
> test_skip if it sees it?

That's another possibility.  Unfortunately, skipped tests seem rather
heavyweight in the test infrastructure and get reported loudly, which
would affect anyone running the tests under Emacs 23.

> Still, I'm excited that you're working on this so please let's get it
> fixed!
> 
> Ethan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] test: Fix HTML rendering test
  2012-10-25  2:11   ` Austin Clements
@ 2012-10-25  8:06     ` Tomi Ollila
  2012-10-25 13:28     ` Ethan Glasser-Camp
  1 sibling, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2012-10-25  8:06 UTC (permalink / raw)
  To: Austin Clements, Ethan Glasser-Camp; +Cc: notmuch

On Thu, Oct 25 2012, Austin Clements <amdragon@MIT.EDU> wrote:

>
> Emacs seems to have as many ways to convert HTML to text as there are
> people trying to run this test.  What's the value of
> mm-text-html-renderer for you in Emacs 24?

On Fedora 17:

 PASS   notmuch-hello-refresh hook is called
 PASS   notmuch-hello-refresh hook is called on updates
 FAIL   Rendering HTML mail with images
 --- emacs.56.OUTPUT   2012-10-25 07:59:22.831311067 +0000
 +++ emacs.56.EXPECTED 2012-10-25 07:59:22.833311095 +0000
 @@ -5,5 +5,4 @@
  
   [ multipart/related ]
    [ text/html ]
    -*
    -smiley 
    +* smiley
nil

emacs-large-search-buffer: Testing Emacs with large search results bu

------------------

emacs -q -nw

emacs-version is a variable defined in `C source code'.
Its value is "24.1.1"

M-x load-library message

mm-text-html-renderer's value is shr

(mm-text-html-renderer-alist not defined at this time)

M-x load-library mm-view

mm-text-html-renderer-alist's value is ((shr . mm-shr)
...


Tomi

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] test: Fix HTML rendering test
  2012-10-25  2:11   ` Austin Clements
  2012-10-25  8:06     ` Tomi Ollila
@ 2012-10-25 13:28     ` Ethan Glasser-Camp
  1 sibling, 0 replies; 5+ messages in thread
From: Ethan Glasser-Camp @ 2012-10-25 13:28 UTC (permalink / raw)
  To: Austin Clements, Ethan Glasser-Camp; +Cc: notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> Quoth Ethan Glasser-Camp on Oct 24 at  9:59 pm:
>> Austin Clements <amdragon@MIT.EDU> writes:
>
> Emacs seems to have as many ways to convert HTML to text as there are
> people trying to run this test.  What's the value of
> mm-text-html-renderer for you in Emacs 24?

I get html2text.

I wanted to write more about what the test should and should not do, but
really I don't know and don't have the time to write about it!

Ethan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-25 13:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-24 20:06 [PATCH] test: Fix HTML rendering test Austin Clements
2012-10-25  1:59 ` Ethan Glasser-Camp
2012-10-25  2:11   ` Austin Clements
2012-10-25  8:06     ` Tomi Ollila
2012-10-25 13:28     ` Ethan Glasser-Camp

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.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).