File: tables.t

package info (click to toggle)
libwiki-toolkit-formatter-usemod-perl 0.25-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 176 kB
  • sloc: perl: 258; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use strict;
use Wiki::Toolkit::Formatter::UseMod;
use Test::More tests => 8;

my $wikitext = <<WIKITEXT;

||foo||bar||
||baz||quux||

WIKITEXT

my $formatter = Wiki::Toolkit::Formatter::UseMod->new;

my $html = $formatter->format( $wikitext );

like( $html, qr'<table', "a table is created" );
like( $html, qr|<tr.*<tr|s, "with two rows" );
like( $html, qr|<td.*<td.*<td.*<td|s, "with four table cells" );
like( $html, qr|foo.*bar.*baz.*quux|s, "textual content is there" );

$wikitext = <<WIKITEXT;

|| foo || bar ||
|| baz || quux ||

WIKITEXT

$html = $formatter->format( $wikitext );

like( $html, qr'<table', "with whitespace... a table is created" );
like( $html, qr|<tr.*<tr|s, "...with two rows" );
like( $html, qr|<td.*<td.*<td.*<td|s, "...with four table cells" );
like( $html, qr|foo.*bar.*baz.*quux|s, "...textual content is there" );