#!/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;