Test.Builder visible span tag on failed test

0 views
Skip to first unread message

Marvin Humphrey

unread,
Jul 22, 2007, 3:14:40 PM7/22/07
to jsan-a...@googlegroups.com
Greets,

I've been trying out Test.More and it's been very easy to use so
far. Kudos, and thanks!

One problem: span tags showing up as visible text for individual
tests formatted as HTML files. I've confirmed this on Firefox (mac),
Safari, and IE6. Sample test output is below my sig; the file the
produced that output can be found here:

http://www.rectangular.com/junk/Test.Simple/tests/bad_output.html

The problem code is this line in Test.Builder:

writer('<span style="color: red; font-weight: bold">'
+ msg + '</span>')

The easiest fix is simply to omit the span tags:

writer(msg)

I tried to figure out a way to change it over to DOM manipulation
techniques, but I wasn't confident I could do that and not run into
output ordering problems with document.write.

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/

1..5
ok 1 - success
not ok 2 - failure
<span style="color: red; font-weight: bold"># Failed test
</span>ok 3 - success
not ok 4 - failure
<span style="color: red; font-weight: bold"># Failed test
</span># Looks like you planned 5 tests but only ran 4.

David E. Wheeler

unread,
Jul 22, 2007, 4:51:07 PM7/22/07
to jsan-a...@googlegroups.com
On Jul 22, 2007, at 12:14, Marvin Humphrey wrote:

> I've been trying out Test.More and it's been very easy to use so
> far. Kudos, and thanks!

Glad you like it, Marvin.

> The problem code is this line in Test.Builder:
>
> writer('<span style="color: red; font-weight: bold">'
> + msg + '</span>')
>
> The easiest fix is simply to omit the span tags:
>
> writer(msg)

Yes, but then you don't get the highlighting. I'm sure this can be
done with DOM manipulation, though. Anyone game to do it?

Best,

David

Marvin Humphrey

unread,
Jul 22, 2007, 5:03:20 PM7/22/07
to jsan-a...@googlegroups.com

On Jul 22, 2007, at 1:51 PM, David E. Wheeler wrote:

>> The problem code is this line in Test.Builder:
>>
>> writer('<span style="color: red; font-weight: bold">'
>> + msg + '</span>')
>>
>> The easiest fix is simply to omit the span tags:
>>
>> writer(msg)
>
> Yes, but then you don't get the highlighting. I'm sure this can be
> done with DOM manipulation, though. Anyone game to do it?

I'm game. I think I can come up with something that's internally
consistent and passes all your tests. I just need to know all the
possible scenarios we need to support. Can a test file do its own
document.write("ok 20\n") ? What else?

David E. Wheeler

unread,
Jul 23, 2007, 12:05:11 AM7/23/07
to jsan-a...@googlegroups.com
On Jul 22, 2007, at 14:03, Marvin Humphrey wrote:

> I'm game. I think I can come up with something that's internally
> consistent and passes all your tests.

That'd be awesome, Marvin, thanks!

> I just need to know all the
> possible scenarios we need to support. Can a test file do its own
> document.write("ok 20\n") ? What else?

Don't know, it has been so long. I think I covered a fair amount of
stuff in the tests, though.

Note that you can grab it from svn here:

https://svn.openjsan.org:81/users/theory/Test.Simple/trunk

Best,

David

Reply all
Reply to author
Forward
0 new messages