• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.
My understanding from CC was that assert_html_equals and assert_html=matches abstract away from the ordering of the attributes in the html. However, that does not appear to be the case, at least for the matches routine, as the attached test case shows (place in test/unit/ directory and run like unit test).

The tests succeed if the parameters are painstakenly ordered as produced by the parse.

Side question... is there a recommended utility to walk the parsed html so that I could go down to the locale of the html I try to compare and use assert_html_equals? -- TW


No, I never said that. assert_html_equals abstracts away, assert_html_matches does not.

There is no recommended utility, as I never thought of doing that, but it should be straightforward to add an entry point. As I said before, assert_html_equals works by parsing the HTML and then serialising it into an array. You could grab that array back, and prune it before stuffing it into Algortihm::Diff. But I never did it.

CC


My use case is that I end up with a bunch of HTML, say, the HTML representing a form. Now I want to check whether the individual field definitions are correct, by (i) finding the fields, and (ii) comparing via assert_html_equals.

Comparing via assert_html_matches avoids having to first find the fields, but it apparently does not have the same power in terms of abstracting away from attribute ordering. That is a bummer, as having to search for the portion of HTML we really want to compare opens up again much dependence on the HTML generation. -- TW


You can always use an RE to subset the HTML to be matched, and then use html_equals. html_matches actually predated html_equals, and I actually regret not removing it. This ought to be fixed, but isn;t pressing, so regrading to Enhancement.

CC

Fixed it. However assert_html_matches now requires a valid block of HTML (not an RE)

CC

ItemTemplate
Summary TWikiTestCase::assert_html_matches sensitive to attribute ordering
ReportedBy TWiki:Main.ThomasWeigert
Codebase ~twiki4
SVN Range TWiki-4.1.0, Thu, 04 Jan 2007, build 12435
AppliesTo Engine
Component UnitTests
Priority Enhancement
CurrentState Closed
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Topic attachments
I Attachment History Action Size Date Who Comment
Perl source code filepm InitFormTests.pm r1 manage 8.8 K 2007-01-07 - 23:30 ThomasWeigert  
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2007-08-03 - TWikiUserMapping_CrawfordCurrie
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback