Alex 'AdUser' Z
10 years ago
2 changed files with 47 additions and 2 deletions
@ -0,0 +1,45 @@
|
||||
#!/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; |
Loading…
Reference in new issue