| 1 |
package tests |
| 2 |
|
| 3 |
import ( |
| 4 |
"bytes" |
| 5 |
"testing" |
| 6 |
|
| 7 |
"github.com/olekukonko/tablewriter" |
| 8 |
"github.com/olekukonko/tablewriter/renderer" |
| 9 |
"github.com/olekukonko/tablewriter/tw" |
| 10 |
) |
| 11 |
|
| 12 |
// TestHTMLBasicTable verifies that a basic HTML table with headers and rows is rendered correctly. |
| 13 |
func TestHTMLBasicTable(t *testing.T) { |
| 14 |
var buf bytes.Buffer |
| 15 |
table := tablewriter.NewTable(&buf, |
| 16 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 17 |
) |
| 18 |
table.Header([]string{"Name", "Age", "City"}) |
| 19 |
table.Append([]string{"Alice", "25", "New York"}) |
| 20 |
table.Append([]string{"Bob", "30", "Boston"}) |
| 21 |
table.Render() |
| 22 |
|
| 23 |
expected := ` |
| 24 |
<table> |
| 25 |
<thead> |
| 26 |
<tr><th style="text-align: center;">NAME</th><th style="text-align: center;">AGE</th><th style="text-align: center;">CITY</th></tr> |
| 27 |
</thead> |
| 28 |
<tbody> |
| 29 |
<tr><td style="text-align: left;">Alice</td><td style="text-align: left;">25</td><td style="text-align: left;">New York</td></tr> |
| 30 |
<tr><td style="text-align: left;">Bob</td><td style="text-align: left;">30</td><td style="text-align: left;">Boston</td></tr> |
| 31 |
</tbody> |
| 32 |
</table>` |
| 33 |
if !visualCheckHTML(t, "HTMLBasicTable", buf.String(), expected) { |
| 34 |
t.Error(table.Debug()) |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
// TestHTMLWithFooterAndAlignment tests an HTML table with a footer and custom column alignments. |
| 39 |
func TestHTMLWithFooterAndAlignment(t *testing.T) { |
| 40 |
var buf bytes.Buffer |
| 41 |
table := tablewriter.NewTable(&buf, |
| 42 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 43 |
tablewriter.WithHeaderConfig(tw.CellConfig{ |
| 44 |
Formatting: tw.CellFormatting{ |
| 45 |
AutoFormat: tw.Off, |
| 46 |
}, |
| 47 |
Alignment: tw.CellAlignment{Global: tw.AlignCenter}, |
| 48 |
}), |
| 49 |
tablewriter.WithRowConfig(tw.CellConfig{ |
| 50 |
Alignment: tw.CellAlignment{PerColumn: []tw.Align{tw.AlignLeft, tw.AlignRight, tw.AlignCenter}}, |
| 51 |
}), |
| 52 |
tablewriter.WithFooterConfig(tw.CellConfig{ |
| 53 |
Alignment: tw.CellAlignment{Global: tw.AlignRight}, |
| 54 |
}), |
| 55 |
) |
| 56 |
table.Header([]string{"Item", "Qty", "Price"}) |
| 57 |
table.Append([]string{"Apple", "5", "1.20"}) |
| 58 |
table.Append([]string{"Banana", "12", "0.35"}) |
| 59 |
table.Footer([]string{"", "Total", "7.20"}) |
| 60 |
table.Render() |
| 61 |
|
| 62 |
expected := ` |
| 63 |
<table> |
| 64 |
<thead> |
| 65 |
<tr><th style="text-align: center;">Item</th><th style="text-align: center;">Qty</th><th style="text-align: center;">Price</th></tr> |
| 66 |
</thead> |
| 67 |
<tbody> |
| 68 |
<tr><td style="text-align: left;">Apple</td><td style="text-align: right;">5</td><td style="text-align: center;">1.20</td></tr> |
| 69 |
<tr><td style="text-align: left;">Banana</td><td style="text-align: right;">12</td><td style="text-align: center;">0.35</td></tr> |
| 70 |
</tbody> |
| 71 |
<tfoot> |
| 72 |
<tr><td style="text-align: right;"></td><td style="text-align: right;">Total</td><td style="text-align: right;">7.20</td></tr> |
| 73 |
</tfoot> |
| 74 |
</table>` |
| 75 |
if !visualCheckHTML(t, "HTMLWithFooterAndAlignment", buf.String(), expected) { |
| 76 |
t.Error(table.Debug()) |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
// TestHTMLEscaping verifies HTML content escaping behavior with and without EscapeContent enabled. |
| 81 |
func TestHTMLEscaping(t *testing.T) { |
| 82 |
// Test case 1: Default (EscapeContent = true) |
| 83 |
var buf bytes.Buffer |
| 84 |
table := tablewriter.NewTable(&buf, |
| 85 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 86 |
) |
| 87 |
table.Header([]string{"Tag", "Attribute"}) |
| 88 |
table.Append([]string{"<br>", "should escape < & >"}) |
| 89 |
table.Render() |
| 90 |
|
| 91 |
expectedEscaped := ` |
| 92 |
<table> |
| 93 |
<thead> |
| 94 |
<tr><th style="text-align: center;">TAG</th><th style="text-align: center;">ATTRIBUTE</th></tr> |
| 95 |
</thead> |
| 96 |
<tbody> |
| 97 |
<tr><td style="text-align: left;"><br></td><td style="text-align: left;">should escape < & ></td></tr> |
| 98 |
</tbody> |
| 99 |
</table> |
| 100 |
` |
| 101 |
if !visualCheckHTML(t, "HTMLEscaping_Default", buf.String(), expectedEscaped) { |
| 102 |
t.Log("--- Debug Log for HTMLEscaping_Default ---") |
| 103 |
t.Log(table.Debug()) |
| 104 |
} |
| 105 |
|
| 106 |
// Test case 2: EscapeContent = false |
| 107 |
buf.Reset() |
| 108 |
tableNoEscape := tablewriter.NewTable(&buf, |
| 109 |
tablewriter.WithRenderer(renderer.NewHTML(renderer.HTMLConfig{EscapeContent: false})), |
| 110 |
) |
| 111 |
tableNoEscape.Header([]string{"Tag", "Attribute"}) |
| 112 |
tableNoEscape.Append([]string{"<br>", "should NOT escape < & >"}) |
| 113 |
tableNoEscape.Render() |
| 114 |
|
| 115 |
expectedUnescaped := ` |
| 116 |
<table> |
| 117 |
<thead> |
| 118 |
<tr><th style="text-align: center;">TAG</th><th style="text-align: center;">ATTRIBUTE</th></tr> |
| 119 |
</thead> |
| 120 |
<tbody> |
| 121 |
<tr><td style="text-align: left;"><br></td><td style="text-align: left;">should NOT escape < & ></td></tr> |
| 122 |
</tbody> |
| 123 |
</table>` |
| 124 |
if !visualCheckHTML(t, "HTMLEscaping_Disabled", buf.String(), expectedUnescaped) { |
| 125 |
t.Log("--- Debug Log for HTMLEscaping_Disabled ---") |
| 126 |
t.Log(table.Debug()) |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
// TestHTMLMultiLine tests HTML table rendering with multiline cell content, noting that newlines create separate rows. |
| 131 |
func TestHTMLMultiLine(t *testing.T) { |
| 132 |
// Test case 1: Default behavior (newlines split into separate rows) |
| 133 |
var buf bytes.Buffer |
| 134 |
table := tablewriter.NewTable(&buf, |
| 135 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 136 |
) |
| 137 |
table.Append([]string{"Line 1\nLine 2", "Single Line"}) |
| 138 |
table.Render() |
| 139 |
|
| 140 |
expected := ` |
| 141 |
<table> |
| 142 |
<tbody> |
| 143 |
<tr><td style="text-align: left;">Line 1</td><td style="text-align: left;">Single Line</td></tr> |
| 144 |
<tr><td style="text-align: left;">Line 2</td><td style="text-align: left;"></td></tr> |
| 145 |
</tbody> |
| 146 |
</table>` |
| 147 |
if !visualCheckHTML(t, "HTMLMultiLine_Default", buf.String(), expected) { |
| 148 |
t.Logf("MultiLine Default Output: %s", buf.String()) |
| 149 |
t.Error(table.Debug()) |
| 150 |
} |
| 151 |
|
| 152 |
// Test case 2: With AddLinesTag (no effect due to newline pre-splitting) |
| 153 |
buf.Reset() |
| 154 |
tableLinesTag := tablewriter.NewTable(&buf, |
| 155 |
tablewriter.WithRenderer(renderer.NewHTML(renderer.HTMLConfig{AddLinesTag: true})), |
| 156 |
) |
| 157 |
tableLinesTag.Append([]string{"Line 1\nLine 2", "Single Line"}) |
| 158 |
tableLinesTag.Render() |
| 159 |
|
| 160 |
expectedLinesTag := ` |
| 161 |
<table> |
| 162 |
<tbody> |
| 163 |
<tr><td style="text-align: left;">Line 1</td><td style="text-align: left;">Single Line</td></tr> |
| 164 |
<tr><td style="text-align: left;">Line 2</td><td style="text-align: left;"></td></tr> |
| 165 |
</tbody> |
| 166 |
</table>` |
| 167 |
if !visualCheckHTML(t, "HTMLMultiLine_LinesTag", buf.String(), expectedLinesTag) { |
| 168 |
t.Logf("MultiLine LinesTag Output: %s", buf.String()) |
| 169 |
t.Log(table.Debug()) |
| 170 |
} |
| 171 |
} |
| 172 |
|
| 173 |
// TestHTMLHorizontalMerge verifies HTML table rendering with horizontal cell merges in headers, rows, and footers. |
| 174 |
func TestHTMLHorizontalMerge(t *testing.T) { |
| 175 |
var buf bytes.Buffer |
| 176 |
table := tablewriter.NewTable(&buf, |
| 177 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 178 |
tablewriter.WithConfig(tablewriter.Config{ |
| 179 |
Header: tw.CellConfig{Merging: tw.CellMerging{Mode: tw.MergeHorizontal}}, |
| 180 |
Row: tw.CellConfig{Merging: tw.CellMerging{Mode: tw.MergeHorizontal}}, |
| 181 |
Footer: tw.CellConfig{Merging: tw.CellMerging{Mode: tw.MergeHorizontal}}, |
| 182 |
}), |
| 183 |
) |
| 184 |
table.Header([]string{"A", "Merged Header", "Merged Header"}) |
| 185 |
table.Append([]string{"Data 1", "Data 2", "Data 2"}) |
| 186 |
table.Append([]string{"Merged Row", "Merged Row", "Data 3"}) |
| 187 |
table.Footer([]string{"Footer 1", "Merged Footer", "Merged Footer"}) |
| 188 |
table.Render() |
| 189 |
|
| 190 |
expected := ` |
| 191 |
<table> |
| 192 |
<thead> |
| 193 |
<tr><th style="text-align: center;">A</th><th colspan="2" style="text-align: center;">MERGED HEADER</th></tr> |
| 194 |
</thead> |
| 195 |
<tbody> |
| 196 |
<tr><td style="text-align: left;">Data 1</td><td colspan="2" style="text-align: left;">Data 2</td></tr> |
| 197 |
<tr><td colspan="2" style="text-align: left;">Merged Row</td><td style="text-align: left;">Data 3</td></tr> |
| 198 |
</tbody> |
| 199 |
<tfoot> |
| 200 |
<tr><td style="text-align: right;">Footer 1</td><td colspan="2" style="text-align: right;">Merged Footer</td></tr> |
| 201 |
</tfoot> |
| 202 |
</table>` |
| 203 |
if !visualCheckHTML(t, "HTMLHorizontalMerge", buf.String(), expected) { |
| 204 |
t.Error(table.Debug()) |
| 205 |
} |
| 206 |
} |
| 207 |
|
| 208 |
// TestHTMLVerticalMerge tests HTML table rendering with vertical cell merges based on repeated values. |
| 209 |
func TestHTMLVerticalMerge(t *testing.T) { |
| 210 |
var buf bytes.Buffer |
| 211 |
table := tablewriter.NewTable(&buf, |
| 212 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 213 |
tablewriter.WithConfig(tablewriter.Config{ |
| 214 |
Row: tw.CellConfig{Merging: tw.CellMerging{Mode: tw.MergeVertical}}, |
| 215 |
}), |
| 216 |
) |
| 217 |
table.Header([]string{"Category", "Item", "Value"}) |
| 218 |
table.Append([]string{"Fruit", "Apple", "10"}) |
| 219 |
table.Append([]string{"Fruit", "Banana", "5"}) |
| 220 |
table.Append([]string{"Fruit", "Orange", "8"}) |
| 221 |
table.Append([]string{"Dairy", "Milk", "2"}) |
| 222 |
table.Append([]string{"Dairy", "Cheese", "4"}) |
| 223 |
table.Append([]string{"Other", "Bread", "3"}) |
| 224 |
table.Render() |
| 225 |
|
| 226 |
expected := ` |
| 227 |
<table> |
| 228 |
<thead> |
| 229 |
<tr><th style="text-align: center;">CATEGORY</th><th style="text-align: center;">ITEM</th><th style="text-align: center;">VALUE</th></tr> |
| 230 |
</thead> |
| 231 |
<tbody> |
| 232 |
<tr><td rowspan="3" style="text-align: left;">Fruit</td><td style="text-align: left;">Apple</td><td style="text-align: left;">10</td></tr> |
| 233 |
<tr><td style="text-align: left;">Banana</td><td style="text-align: left;">5</td></tr> |
| 234 |
<tr><td style="text-align: left;">Orange</td><td style="text-align: left;">8</td></tr> |
| 235 |
<tr><td rowspan="2" style="text-align: left;">Dairy</td><td style="text-align: left;">Milk</td><td style="text-align: left;">2</td></tr> |
| 236 |
<tr><td style="text-align: left;">Cheese</td><td style="text-align: left;">4</td></tr> |
| 237 |
<tr><td style="text-align: left;">Other</td><td style="text-align: left;">Bread</td><td style="text-align: left;">3</td></tr> |
| 238 |
</tbody> |
| 239 |
</table>` |
| 240 |
if !visualCheckHTML(t, "HTMLVerticalMerge", buf.String(), expected) { |
| 241 |
t.Error(table.Debug()) |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
// TestHTMLCombinedMerge verifies HTML table rendering with both horizontal and vertical cell merges. |
| 246 |
func TestHTMLCombinedMerge(t *testing.T) { |
| 247 |
var buf bytes.Buffer |
| 248 |
table := tablewriter.NewTable(&buf, |
| 249 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 250 |
tablewriter.WithConfig(tablewriter.Config{ |
| 251 |
Row: tw.CellConfig{Merging: tw.CellMerging{Mode: tw.MergeBoth}}, |
| 252 |
}), |
| 253 |
) |
| 254 |
table.Header([]string{"Region", "Quarter", "Sales", "Target"}) |
| 255 |
table.Append([]string{"North", "Q1", "1000", "900"}) |
| 256 |
table.Append([]string{"North", "Q2", "1200", "1100"}) |
| 257 |
table.Append([]string{"South", "Q1+Q2", "Q1+Q2", "2000"}) |
| 258 |
table.Append([]string{"East", "Q1", "800", "850"}) |
| 259 |
table.Append([]string{"East", "Q2", "950", "850"}) |
| 260 |
table.Render() |
| 261 |
|
| 262 |
expected := ` |
| 263 |
<table> |
| 264 |
<thead> |
| 265 |
<tr><th style="text-align: center;">REGION</th><th style="text-align: center;">QUARTER</th><th style="text-align: center;">SALES</th><th style="text-align: center;">TARGET</th></tr> |
| 266 |
</thead> |
| 267 |
<tbody> |
| 268 |
<tr><td rowspan="2" style="text-align: left;">North</td><td style="text-align: left;">Q1</td><td style="text-align: left;">1000</td><td style="text-align: left;">900</td></tr> |
| 269 |
<tr><td style="text-align: left;">Q2</td><td style="text-align: left;">1200</td><td style="text-align: left;">1100</td></tr> |
| 270 |
<tr><td style="text-align: left;">South</td><td colspan="2" style="text-align: left;">Q1+Q2</td><td style="text-align: left;">2000</td></tr> |
| 271 |
<tr><td rowspan="2" style="text-align: left;">East</td><td style="text-align: left;">Q1</td><td style="text-align: left;">800</td><td rowspan="2" style="text-align: left;">850</td></tr> |
| 272 |
<tr><td style="text-align: left;">Q2</td><td style="text-align: left;">950</td></tr> |
| 273 |
</tbody> |
| 274 |
</table>` |
| 275 |
if !visualCheckHTML(t, "HTMLCombinedMerge", buf.String(), expected) { |
| 276 |
t.Logf("Combined Merge Output: %s", buf.String()) |
| 277 |
t.Error(table.Debug()) |
| 278 |
} |
| 279 |
} |
| 280 |
|
| 281 |
// TestHTMLHierarchicalMerge tests HTML table rendering with hierarchical cell merges. |
| 282 |
func TestHTMLHierarchicalMerge(t *testing.T) { |
| 283 |
var buf bytes.Buffer |
| 284 |
table := tablewriter.NewTable(&buf, |
| 285 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 286 |
tablewriter.WithConfig(tablewriter.Config{ |
| 287 |
Row: tw.CellConfig{Merging: tw.CellMerging{Mode: tw.MergeHierarchical}}, |
| 288 |
}), |
| 289 |
tablewriter.WithHeaderConfig(tw.CellConfig{ |
| 290 |
Formatting: tw.CellFormatting{ |
| 291 |
AutoFormat: tw.Off, |
| 292 |
}, |
| 293 |
Alignment: tw.CellAlignment{Global: tw.AlignCenter}, |
| 294 |
}), |
| 295 |
) |
| 296 |
table.Header([]string{"L1", "L2", "L3"}) |
| 297 |
table.Append([]string{"A", "a", "1"}) |
| 298 |
table.Append([]string{"A", "b", "2"}) |
| 299 |
table.Append([]string{"A", "b", "3"}) |
| 300 |
table.Append([]string{"B", "c", "4"}) |
| 301 |
table.Render() |
| 302 |
|
| 303 |
expected := ` |
| 304 |
<table> |
| 305 |
<thead> |
| 306 |
<tr><th style="text-align: center;">L1</th><th style="text-align: center;">L2</th><th style="text-align: center;">L3</th></tr> |
| 307 |
</thead> |
| 308 |
<tbody> |
| 309 |
<tr><td rowspan="3" style="text-align: left;">A</td><td style="text-align: left;">a</td><td style="text-align: left;">1</td></tr> |
| 310 |
<tr><td rowspan="2" style="text-align: left;">b</td><td style="text-align: left;">2</td></tr> |
| 311 |
<tr><td style="text-align: left;">3</td></tr> |
| 312 |
<tr><td style="text-align: left;">B</td><td style="text-align: left;">c</td><td style="text-align: left;">4</td></tr> |
| 313 |
</tbody> |
| 314 |
</table>` |
| 315 |
if !visualCheckHTML(t, "HTMLHierarchicalMerge", buf.String(), expected) { |
| 316 |
t.Error(table.Debug()) |
| 317 |
} |
| 318 |
} |
| 319 |
|
| 320 |
// TestHTMLEmptyTable verifies HTML rendering for empty tables and tables with only headers. |
| 321 |
func TestHTMLEmptyTable(t *testing.T) { |
| 322 |
// Test case 1: Completely empty table |
| 323 |
var buf bytes.Buffer |
| 324 |
table := tablewriter.NewTable(&buf, |
| 325 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 326 |
) |
| 327 |
table.Render() |
| 328 |
|
| 329 |
expected := ` |
| 330 |
<table> |
| 331 |
</table>` |
| 332 |
if !visualCheckHTML(t, "HTMLEmptyTable", buf.String(), expected) { |
| 333 |
t.Logf("Empty table output: '%s'", buf.String()) |
| 334 |
t.Error(table.Debug()) |
| 335 |
} |
| 336 |
|
| 337 |
// Test case 2: Header-only table |
| 338 |
buf.Reset() |
| 339 |
tableHeaderOnly := tablewriter.NewTable(&buf, |
| 340 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 341 |
) |
| 342 |
tableHeaderOnly.Header([]string{"Col A"}) |
| 343 |
tableHeaderOnly.Render() |
| 344 |
|
| 345 |
expectedHeaderOnly := ` |
| 346 |
<table> |
| 347 |
<thead> |
| 348 |
<tr><th style="text-align: center;">COL A</th></tr> |
| 349 |
</thead> |
| 350 |
</table>` |
| 351 |
if !visualCheckHTML(t, "HTMLEmptyTable_HeaderOnly", buf.String(), expectedHeaderOnly) { |
| 352 |
t.Log(table.Debug()) |
| 353 |
} |
| 354 |
} |
| 355 |
|
| 356 |
// TestHTMLCSSClasses tests HTML table rendering with custom CSS classes for table, sections, and rows. |
| 357 |
func TestHTMLCSSClasses(t *testing.T) { |
| 358 |
var buf bytes.Buffer |
| 359 |
htmlCfg := renderer.HTMLConfig{ |
| 360 |
TableClass: "my-table", HeaderClass: "my-thead", BodyClass: "my-tbody", |
| 361 |
FooterClass: "my-tfoot", RowClass: "my-row", HeaderRowClass: "my-header-row", |
| 362 |
FooterRowClass: "my-footer-row", |
| 363 |
} |
| 364 |
table := tablewriter.NewTable(&buf, |
| 365 |
tablewriter.WithRenderer(renderer.NewHTML(htmlCfg)), |
| 366 |
tablewriter.WithHeaderConfig(tw.CellConfig{ |
| 367 |
Formatting: tw.CellFormatting{AutoFormat: tw.Off}, |
| 368 |
Alignment: tw.CellAlignment{Global: tw.AlignCenter}, |
| 369 |
}), |
| 370 |
) |
| 371 |
table.Header([]string{"H1"}) |
| 372 |
table.Append([]string{"R1"}) |
| 373 |
table.Footer([]string{"F1"}) |
| 374 |
table.Render() |
| 375 |
|
| 376 |
expected := ` |
| 377 |
<table class="my-table"> |
| 378 |
<thead class="my-thead"> |
| 379 |
<tr class="my-header-row"><th style="text-align: center;">H1</th></tr> |
| 380 |
</thead> |
| 381 |
<tbody class="my-tbody"> |
| 382 |
<tr class="my-row"><td style="text-align: left;">R1</td></tr> |
| 383 |
</tbody> |
| 384 |
<tfoot class="my-tfoot"> |
| 385 |
<tr class="my-footer-row"><td style="text-align: right;">F1</td></tr> |
| 386 |
</tfoot> |
| 387 |
</table>` |
| 388 |
if !visualCheckHTML(t, "HTMLCSSClasses", buf.String(), expected) { |
| 389 |
t.Error(table.Debug()) |
| 390 |
} |
| 391 |
} |
| 392 |
|
| 393 |
// TestHTMLStructureStrict verifies the exact HTML structure of a table without whitespace or formatting variations. |
| 394 |
func TestHTMLStructureStrict(t *testing.T) { |
| 395 |
var buf bytes.Buffer |
| 396 |
table := tablewriter.NewTable(&buf, |
| 397 |
tablewriter.WithRenderer(renderer.NewHTML()), |
| 398 |
) |
| 399 |
table.Header([]string{"A", "B"}) |
| 400 |
table.Append([]string{"1", "2"}) |
| 401 |
table.Append([]string{"3", "4"}) |
| 402 |
table.Footer([]string{"F1", "F2"}) |
| 403 |
table.Render() |
| 404 |
|
| 405 |
expectedStructure := `<table><thead><tr><th style="text-align: center;">A</th><th style="text-align: center;">B</th></tr></thead><tbody><tr><td style="text-align: left;">1</td><td style="text-align: left;">2</td></tr><tr><td style="text-align: left;">3</td><td style="text-align: left;">4</td></tr></tbody><tfoot><tr><td style="text-align: right;">F1</td><td style="text-align: right;">F2</td></tr></tfoot></table>` |
| 406 |
|
| 407 |
outputNormalized := normalizeHTMLStrict(buf.String()) |
| 408 |
if outputNormalized != expectedStructure { |
| 409 |
t.Errorf("HTMLStructureStrict: Mismatch") |
| 410 |
t.Errorf("Expected Structure:\n%s", expectedStructure) |
| 411 |
t.Errorf("Got Normalized Output:\n%s", outputNormalized) |
| 412 |
t.Errorf("Got Raw Output:\n%s", buf.String()) |
| 413 |
} |
| 414 |
} |