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.
46 lines
866 B
46 lines
866 B
10 years ago
|
#!/usr/bin/env perl
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
use utf8;
|
||
|
|
||
|
use Test::More tests => 10;
|
||
|
use Text::Dokuwiki::Regexps;
|
||
|
|
||
|
my $rx = $Text::Dokuwiki::Regexps::regexps;
|
||
|
use re 'debugcolor';
|
||
|
my $text = <<'TEXT';
|
||
|
|
||
|
Header 1st level
|
||
|
=================
|
||
|
|
||
|
TEXT
|
||
|
my $matched = 'Header 1st level';
|
||
|
|
||
|
my @matches = $text =~ m/$rx->{header}/;
|
||
|
is(scalar @matches, 2);
|
||
|
is($+{header}, $matched);
|
||
|
is($+{line}, '=================');
|
||
|
is($matches[0], $matched);
|
||
|
is($matches[1], '=================');
|
||
|
|
||
|
$text = <<'TEXT';
|
||
|
|
||
|
Header 2nd level
|
||
|
-----------------
|
||
|
|
||
|
TEXT
|
||
|
$matched = 'Header 2nd level';
|
||
|
@matches = $text =~ m/$rx->{header}/;
|
||
|
is(scalar @matches, 2);
|
||
|
is($matches[0], $matched);
|
||
|
is($matches[1], '-----------------');
|
||
|
|
||
|
$text = "Header only\n-------------";
|
||
|
$matched = 'Header only';
|
||
|
@matches = $text =~ m/$rx->{header}/;
|
||
|
is($matches[0], $matched);
|
||
|
is($matches[1], '-------------');
|
||
|
|
||
|
exit 0;
|