You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
913 B
51 lines
913 B
10 years ago
|
#!/usr/bin/env perl
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
use utf8;
|
||
|
|
||
|
use Test::More tests => 8;
|
||
|
use Text::Dokuwiki::Regexps;
|
||
|
|
||
|
my $rx = $Text::Dokuwiki::Regexps::regexps;
|
||
|
my $text = <<'TEXT';
|
||
|
|
||
|
^ header ^ header ^
|
||
|
| data | data |
|
||
|
|
||
|
TEXT
|
||
|
|
||
|
my $matched = <<'TEXT';
|
||
|
^ header ^ header ^
|
||
|
| data | data |
|
||
|
TEXT
|
||
|
|
||
|
my @matches = $text =~ m/$rx->{table}/;
|
||
|
is(scalar @matches, 1);
|
||
|
is($+{table}, $matched);
|
||
|
is($matches[0], $matched);
|
||
|
|
||
|
$text = <<'TEXT';
|
||
|
^ header ^ header ^
|
||
|
| data | data | missing trailing border
|
||
|
TEXT
|
||
|
@matches = $text =~ m/$rx->{table}/;
|
||
|
is(scalar @matches, 1);
|
||
|
is($matches[0], "^ header ^ header ^\n");
|
||
|
|
||
|
$text = <<'TEXT';
|
||
|
^ header ^ header ^
|
||
|
missing leading border | data | data |
|
||
|
TEXT
|
||
|
@matches = $text =~ m/$rx->{table}/;
|
||
|
is(scalar @matches, 1);
|
||
|
is($matches[0], "^ header ^ header ^\n");
|
||
|
|
||
|
$text = <<'TEXT';
|
||
|
^ not match, two leading spaces |
|
||
|
TEXT
|
||
|
@matches = $text =~ m/$rx->{table}/;
|
||
|
is(scalar @matches, 0);
|
||
|
|
||
|
exit 0;
|