#!/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'; - item 1 - item 2 * item 1 level 2 * item 2 level 2 - item 3 TEXT my $matched = <<'TEXT'; - item 1 - item 2 * item 1 level 2 * item 2 level 2 - item 3 TEXT my @matches = $text =~ m/$rx->{list}/; is($+{list}, $matched); is(scalar @matches, 1); $text = <<'TEXT'; - not enough identation TEXT @matches = $text =~ m/$rx->{list}/; is(scalar @matches, 0); $text = <<'TEXT'; - item * item TEXT @matches = $text =~ m/$rx->{list}/; is(scalar @matches, 1); is($matches[0], $text); $text = <<'TEXT'; + wrong item marker TEXT @matches = $text =~ m/$rx->{list}/; is(scalar @matches, 0); $text = ' * missing newline'; @matches = $text =~ m/$rx->{list}/; is(scalar @matches, 1); is($matches[0], $text); exit 0;