Leon Brocard wrote:
> The attached patches to the tests increase the coverage by a little.
Great work. Especially with my recent XS coding, I worry that the tests
haven't covered all possible cases.
However, under perl 5.005_03 on FreeBSD 4.3, the html.t test produces
border/cellpadding attributes in the opposite order. Are hash keys
sorted differently in perl 5.6?
To work around this problem, the .split.sort.join virtual methods can
be used like this:
[% HTML.element(table=>{ border=> 1, cellpadding=> 2 }).split.sort.join
%]
to produce output in a predictable order (taking advantage of the fact
that ''<table'' will come before the other attributes).
For the record, here are the original html.t test failures:
MATCH FAILED
input: [[% USE HTML -%]
[% HTML.element(table => { border => 1, cellpadding => 2 }) %]
]
expect: [<table cellpadding="2" border="1">]
output: [<table border="1" cellpadding="2">]
not ok 14
MATCH FAILED
input: [[% USE HTML -%]
[% HTML.attributes(border => 1, cellpadding => 2) %]
]
expect: [cellpadding="2" border="1"]
output: [border="1" cellpadding="2"]
not ok 16
- doug
--- html.t.orig Wed Aug 22 15:40:34 2001
+++ html.t Wed Aug 22 16:04:12 2001
@@ -57,3 +57,21 @@
[%- END %]
-- expect --
< & >
+
+-- test --
+[% USE HTML -%]
+[% HTML.escape("if (a < b && c > d) ...") %]
+-- expect --
+if (a < b && c > d) ...
+
+-- test --
+[% USE HTML -%]
+[% HTML.element(table => { border => 1, cellpadding => 2 }).split.sort.join %]
+-- expect --
+<table border="1" cellpadding="2">
+
+-- test --
+[% USE HTML -%]
+[% HTML.attributes(border => 1, cellpadding => 2).split.sort.join %]
+-- expect --
+border="1" cellpadding="2"